meetup_auth | R Documentation |
meetupr
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()
token |
optional; an actual token object or the path to a valid token
stored as an |
new_user |
logical, defaults to |
key, secret |
the "Client ID" and "Client secret" for the application;
defaults to the ID and secret built into the |
cache |
logical indicating if |
verbose |
logical; do you want informative messages? |
use_appdir |
Logical indicating whether to save the created token
in app dir as determined by |
token_path |
Path where to save the token. If |
clear_cache |
logical indicating whether to disable the
|
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.
## Not run: ## 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 ## End(Not run) ## Not run: meetup_token() ## End(Not run) ## Not run: meetup_deauth() ## End(Not run) meetup_token_path()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.