meetupr
meetup-auth.Rd
Authorize meetupr
via the OAuth API. You will be directed to a web
browser, asked to sign in to your Meetup account, and to grant meetupr
permission to operate on your behalf. By default, these user credentials are
saved to a file in your home directory whose path is saved in .Renviron
as MEETUPR_PAT
.
If you set use_appdir
to FALSE
but cache
to TRUE
,
they are cached in a file named .httr-oauth
in the current working directory.
To control where the file is saved, use token_path
.
If token is not already available, call meetup_auth
to either
load from cache or initiate OAuth2.0 flow. Return the token -- not "bare"
but, rather, prepared for inclusion in downstream requests.
Suspend meetupr
's authorization to place requests to the Meetup
APIs on behalf of the authenticated user.
meetup_auth(
token = meetup_token_path(),
new_user = FALSE,
key = getOption("meetupr.consumer_key"),
secret = getOption("meetupr.consumer_secret"),
cache = getOption("meetupr.httr_oauth_cache", TRUE),
verbose = meetupr_verbose(),
use_appdir = TRUE,
token_path = NULL
)
meetup_token(verbose = FALSE)
meetup_deauth(clear_cache = TRUE, verbose = meetupr_verbose())
meetup_token_path()
optional; an actual token object or the path to a valid token
stored as an .rds
file.
logical, defaults to FALSE
. Set to TRUE
if you
want to wipe the slate clean and re-authenticate with the same or different
Meetup account. This disables the .httr-oauth
file in current
working directory.
the "Client ID" and "Client secret" for the application;
defaults to the ID and secret built into the meetupr
package
logical indicating if meetupr
should cache
credentials in the default cache file .httr-oauth
or token_path
.
logical; do you want informative messages? TRUE
by default in
interactive sessions. Can be toggled by the meetupr.verbose
option.
Logical indicating whether to save the created token
in app dir as determined by rappdirs::user_data_dir("meetupr", "meetupr")
.
If cache
is FALSE
this is ignored.
Path where to save the token. If use_appdir
is TRUE
,
this is ignored.
logical indicating whether to disable the
.httr-oauth
file in working directory, if such exists, by renaming
to .httr-oauth-SUSPENDED
a request
object (an S3 class provided by httr
)
Either NULL or the path in which the token is saved.
Save this token somewhere on disk (token_path
argument of meetup_auth
).
Then in future sessions call meetup_auth()
with token
set to that path.
Most users, most of the time, do not need to call this function explicitly -- it will be triggered by the first action that requires authorization. Even when called, the default arguments will often suffice. However, when necessary, this function allows the user to
force the creation of a new token
retrieve current token as an object, for possible storage to an
.rds
file
read the token from an object or from an .rds
file
provide your own app key and secret -- this requires setting up a new OAuth consumer on Meetup
prevent caching of credentials
In a direct call to meetup_auth
, the user can provide the token, app
key and secret explicitly and can dictate whether interactively-obtained
credentials will be cached. If unspecified, these
arguments are controlled via options, which, if undefined at the time
meetupr
is loaded, are defined like so:
Set to option meetupr.consumer_key
, which defaults to a
consumer key that ships with the package
Set to option meetupr.consumer_secret
, which defaults to
a consumer secret that ships with the package
To override these defaults in persistent way, predefine one or more of them
with lines like this in a .Rprofile
file:
options(meetupr.consumer_key = "FOO",
meetupr.consumer_secret = "BAR")
See Startup
for possible locations for this file and the
implications thereof.
More detail is available from Authenticating with the Meetup API.
if (FALSE) {
## load/refresh existing credentials, if available
## otherwise, go to browser for authentication and authorization
meetup_auth()
## store token in an object and then to file
ttt <- meetup_auth()
saveRDS(ttt, "ttt.rds")
## load a pre-existing token
meetup_auth(token = ttt) # from an object
meetup_auth(token = "ttt.rds") # from .rds file
}
if (FALSE) {
meetup_token()
}
if (FALSE) {
meetup_deauth()
}
meetup_token_path()
#> NULL