OAuth2 authentication to ICD API
Usage
icd_oauth_client(
id = Sys.getenv("ICD_CLIENT_ID"),
token_url = "https://icdaccessmanagement.who.int/connect/token",
secret = Sys.getenv("ICD_CLIENT_SECRET"),
name = "icd_client",
...
)
icd_authenticate(
req,
client = icd_oauth_client(),
scope = "icdapi_access",
...
)
Arguments
- id
Consumer key, also sometimes called the client ID.
- token_url
url used to exchange unauthenticated for authenticated token.
- secret
Consumer secret, also sometimes called the client secret. Despite its name, this does not necessarily need to be protected like a password, i.e. the user still has to authenticate themselves and grant the app permission to access resources on their behalf.
- name
Name of the application. This is not used for OAuth, but is used to make it easier to identify different applications.
- ...
Other parameters/arguments to be passed onto
httr2::oauth_client()
or tohttr2::req_oauth_client_credentials()
- req
A request
- client
An OAuth2 client. Default is a call to
icd_oauth_client()
.- scope
Scopes to be requested from the resource owner. Default is "icdapi_access" as specified in the ICD API documentation.