orcid_auth: ORCID authorization

Description Usage Arguments Details Value ORCID OAuth Scopes Computing environments without browsers Note Examples

View source: R/auth.R

Description

ORCID authorization

Usage

1
2
3
4
5
6
7
orcid_auth(
  scope = "/authenticate",
  reauth = FALSE,
  redirect_uri = getOption("rorcid.redirect_uri"),
  client_id = NULL,
  client_secret = NULL
)

Arguments

scope

(character) one or more scopes. default: "/authenticate". see "ORCID OAuth Scopes" section below for other scope options

reauth

(logical) Force re-authorization? default: FALSE

redirect_uri

(character) a redirect URI. optional. set by passing to this parameter or using the R option rorcid.redirect_uri

client_id

(character) a client id. optional

client_secret

(character) a client secret. optional

Details

There are three ways to authorise with rorcid:

We recommend the 3rd option if possible, specifically, storing the token as an environment variable permanently.

If authentication fails, you can still use rorcid. ORCID does not require authentication at this point, but may in the future - this prepares you for when that happens :)

Value

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

ORCID OAuth Scopes

https://info.orcid.org/faq/what-is-an-oauth-scope-and-which-scopes-does-orcid-support/

Computing environments without browsers

One pitfall is when you are using rorcid on a server, and you're ssh'ed in, so that there's no way to open a browser to do the OAuth browser flow. Similarly for any other situation in which a browser can not be opened. In this case, run orcid_auth() on another machine in which you do have the ability to open a browser, then collect the info that's ouptput from orcid_auth() and store it as an environment variable (see above).

Note

This function is used within rorcid to get/do authentication.

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
x <- orcid_auth()
orcid_auth(reauth = TRUE)
# orcid_auth(scope = "/read-public", reauth = TRUE)

# supply client_id AND client_secret to avoid 3 legged, interactive OAuth
# orcid_auth(client_id = "---", client_secret = "---")

## End(Not run)

rorcid documentation built on Jan. 21, 2021, 1:06 a.m.