namc_oauth2 | R Documentation |
R6 class for handling NAMC oAuth2
a namc_oauth2
class (R6 class)
NAMCr::base_class
-> namc_oauth2
is_configured
shows the configured state of the namc_oauth2 object Set connection details
Sets the clientID and URL for the authentication provider
set_connection_details()
namc_oauth2$set_connection_details(clientId, domain)
clientId
string The auth clientID.
domain
string The auth domain name.
namc_oauth2 An R6 class.
auth_config = list(...) # namc_oauth2 public or private variables auth = namc_oauth2$new(argList = auth_config) auth$set_connection_details("XXXXXXXXXX", "namc.XXXXXXX.edu") Get user info Gets the user information from the auth provider once authenticated.
get_user_info()
namc_oauth2$get_user_info()
list A list containing the available user data.
auth_config = list(...) # namc_oauth2 public or private variables auth = namc_oauth2$new(argList = auth_config) user_info = auth$get_user_info() Get oAuth2 token Gets and oAuth2 token object which can be used for subsequent connections. A stop error occurs if this authentication object has not been configured via set_connection_details().
get_token()
namc_oauth2$get_token(auto_refresh = TRUE)
auto_refresh
Logical TRUE/FALSE to override the objects default behavior
list An oAuth2 token structure from httr::oauth2.0_token
auth_config = list(...) # namc_oauth2 public or private variables auth = namc_oauth2$new(argList = auth_config) oauth_token = auth$get_token() Get access token Extracts the access token from the cached oAuth2 credential. This is used for the Bearer Authentication header.
get_access_token()
namc_oauth2$get_access_token()
string The oAuth2 access token
auth_config = list(...) # namc_oauth2 public or private variables auth = namc_oauth2$new(argList = auth_config) oauth_access_token = auth$get_access_token() Check refresh token Check if the oAuth2 token needs refreshing
requires_refresh()
namc_oauth2$requires_refresh()
namc_oauth2 An R6 class.
auth_config = list(...) # namc_oauth2 public or private variables auth = namc_oauth2$new(argList = auth_config) auth$requires_refresh() Refresh token Refreshes the oAuth2 token
refresh_token()
namc_oauth2$refresh_token()
namc_oauth2 An R6 class.
auth_config = list(...) # namc_oauth2 public or private variables auth = namc_oauth2$new(argList = auth_config) auth$refresh_token() Reset token Deletes cached token file .httr-oauth
reset_token()
namc_oauth2$reset_token()
namc_oauth2 An R6 class.
auth_config = list(...) # namc_oauth2 public or private variables auth = namc_oauth2$new(argList = auth_config) auth$reset_token()
clone()
The objects of this class are cloneable with this method.
namc_oauth2$clone(deep = FALSE)
deep
Whether to make a deep clone.
auth_config = list(...) # namc_oauth2 public or private variables
auth = namc_oauth2$new(argList = auth_config)
## ------------------------------------------------
## Method `namc_oauth2$set_connection_details`
## ------------------------------------------------
auth_config = list(...) # namc_oauth2 public or private variables
auth = namc_oauth2$new(argList = auth_config)
auth$set_connection_details("XXXXXXXXXX", "namc.XXXXXXX.edu")
Get user info
Gets the user information from the auth provider once authenticated.
## ------------------------------------------------
## Method `namc_oauth2$get_user_info`
## ------------------------------------------------
auth_config = list(...) # namc_oauth2 public or private variables
auth = namc_oauth2$new(argList = auth_config)
user_info = auth$get_user_info()
Get oAuth2 token
Gets and oAuth2 token object which can be used for subsequent connections.
A stop error occurs if this authentication object has not been configured via
set_connection_details().
## ------------------------------------------------
## Method `namc_oauth2$get_token`
## ------------------------------------------------
auth_config = list(...) # namc_oauth2 public or private variables
auth = namc_oauth2$new(argList = auth_config)
oauth_token = auth$get_token()
Get access token
Extracts the access token from the cached oAuth2 credential. This is
used for the Bearer Authentication header.
## ------------------------------------------------
## Method `namc_oauth2$get_access_token`
## ------------------------------------------------
auth_config = list(...) # namc_oauth2 public or private variables
auth = namc_oauth2$new(argList = auth_config)
oauth_access_token = auth$get_access_token()
Check refresh token
Check if the oAuth2 token needs refreshing
## ------------------------------------------------
## Method `namc_oauth2$requires_refresh`
## ------------------------------------------------
auth_config = list(...) # namc_oauth2 public or private variables
auth = namc_oauth2$new(argList = auth_config)
auth$requires_refresh()
Refresh token
Refreshes the oAuth2 token
## ------------------------------------------------
## Method `namc_oauth2$refresh_token`
## ------------------------------------------------
auth_config = list(...) # namc_oauth2 public or private variables
auth = namc_oauth2$new(argList = auth_config)
auth$refresh_token()
Reset token
Deletes cached token file .httr-oauth
## ------------------------------------------------
## Method `namc_oauth2$reset_token`
## ------------------------------------------------
auth_config = list(...) # namc_oauth2 public or private variables
auth = namc_oauth2$new(argList = auth_config)
auth$reset_token()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.