Learn R Programming

rorcid (version 0.4.0)

orcid_auth: ORCID authorization

Description

ORCID authorization

Usage

orcid_auth(scope = "/authenticate", reauth = FALSE,
  redirect_uri = getOption("rorcid.redirect_uri"))

Arguments

scope

(character) one or more scopes. default: "/authenticate"

reauth

(logical) Force re-authorization?

redirect_uri

(character) a redirect URI. optional

Value

a character string with the access token prefixed with "Bearer "

ORCID OAuth Scopes

See https://members.orcid.org/api/orcid-scopes for more

Details

There are two ways to authorise with rorcid:

  • Use a token as a result of a OAuth authentication process. The token is a alphanumeric UUID, e.g. dc0a6b6b-b4d4-4276-bc89-78c1e9ede56e. You can get this token by doing xxx. Then store it either as en environment variable in your .Renviron file in your home directory, or as an R option in your .Rprofile file. See Startup for more information. Either an environment variable or R option work. If we don't find either we do the next option.

  • Interactively login with OAuth. This doesn't require any input on your part. We use a client id and client secret key to ping ORCID.org; at which point you log in with your username/password; then we get back a token (same as the above option). We don't know your username or password, only the token that we get back. We cache that token locally in a hidden file in whatever working directory you're in. If you delete that file, or run the code from a new working directory, then we re-authorize.

We recommend the former option. That is, get a token and store it as an environment variable.

If both options above fail, we proceed without using authentication. ORCID does not require authentication at this point, but may in the future - this prepares you for when that happens :)

Examples

Run this code
# NOT RUN {
x <- orcid_auth()
orcid_auth(reauth = TRUE)
#orcid_auth(scope = "/read-public", reauth = TRUE)
# }

Run the code above in your browser using DataLab