This is a function to authorize ottrpal to access calendly, github or google noninteractively from passing in a keys or tokens.
auth_from_secret(
app_name,
token,
access_token,
refresh_token,
cache = FALSE,
in_test = FALSE
)
Which app are you trying to authorize? 'google', 'calendly' or 'github'?
For calendly or github, pass in the API key or Personal Access Token that you have set up from going to https://github.com/settings/tokens/new or https://calendly.com/integrations/api_webhooks respectively.
For Google, access token can be obtained from running authorize interactively: token <-authorize(); token$credentials$access_token
For Google, refresh token can be obtained from running authorize interactively: token <-authorize(); token$credentials$refresh_token
Should the credentials be cached? TRUE or FALSE?
If setting up auth in a test, set to TRUE so that way the authorization doesn't stick
OAuth token saved to the environment so the package access the API data
if (FALSE) { # \dontrun{
# Example for GitHub
# You go to https://github.com/settings/tokens/new to get a Personal Access Token
auth_from_secret("github", token = "ghp_a_github_pat_here")
# Example for authorizing for Google
token <- authorize("google")
auth_from_secret(
app_name = "google",
access_token = token$credentials$access_token,
refresh_token = token$credentials$refresh_token
)
} # }