R/get_token.R

#' get_token
#'
#' \code{get_token} provides a easy way for the user to POST the JWT authentication and receive a token to use the API

#'
#' @param \code{email}: \code{character string} with user's email.
#' @param \code{password}:\code{character string} with  user's password.
#' @usage get_token(email=xxxx, password=xxx)
#' @return it returns the user's individual token
#' @examples
#' get_token(email=xxxx, password=xxxxx)
#' @import httr
#' @import rvest
#' @import purrr
#' @import jsonlite
#' @import tibble
#' @importFrom magrittr "%>%"
#' @export


get_token <- function(email, password){
get_jwt <- httr::POST("https://api.fogocruzado.org.br/api/v1/auth/login",
                      query = list(email = email, password = password))


token <- httr::content(get_jwt)$access_token
return(token)

}
TiagoVentura/get_fogocruzado documentation built on June 27, 2019, 12:19 a.m.