#' Login thorough a social provider.
#'
#' @param url Default Cloudstan API url.
#' @param method Provider to use (google, github)
#'
#' @export
#'
#' @examples
#' login(method = 'google')
#'
login <- function(url = cloudstan_url("/api"), method = "google") {
message(paste("* Logging into Cloudstan using", method))
args <- c(
"auth", "login",
"--url", url,
"--method", method
)
rsp <- exec_bin(args)
if(rsp[1] == "ERROR") {
stop(paste(rsp$code, ": ", rsp$message))
}
message("Login successful!")
}
#' Helper function to login through GitHub.
#'
#' @export
#'
login_github <- function() {
login(method = "github")
}
#' Helper function to login through Google.
#'
#' @export
#'
login_google <- function() {
login(method = "google")
}
#' Print information about the currently authenticated
#' user.
#'
#' @export
#'
user_info <- function() {
fetch_and_print_table(c("auth", "self"))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.