req_oauth_device {httr2} | R Documentation |
This uses oauth_flow_device()
to generate an access token, which is
then used to authentication the request with req_auth_bearer_token()
.
The token is automatically cached (either in memory or on disk) to minimise
the number of times the flow is performed.
req_oauth_device(
req,
client,
cache_disk = FALSE,
cache_key = NULL,
scope = NULL,
auth_params = list(),
token_params = list()
)
req |
A request. |
client |
An |
cache_disk |
Should the access token be cached on disk? This reduces the number of times that you need to re-authenticate at the cost of storing access credentials on disk. Cached tokens are encrypted and automatically deleted 30 days after creation. |
cache_key |
If you want to cache multiple tokens per app, use this key to disambiguate them. |
scope |
Scopes to be requested from the resource owner. |
auth_params |
List containing additional parameters passed to |
token_params |
List containing additional parameters passed to the
|
A modified HTTP request.
client <- oauth_client("example", "https://example.com/get_token")
req <- request("https://example.com")
req %>% req_oauth_device(client)