Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

token_fetch

Fetch a token for the given scopes


Description

This is a rather magical function that calls a series of concrete credential-fetching functions, each wrapped in a tryCatch(). token_fetch() keeps trying until it succeeds or there are no more functions to try. Use cred_funs_list() to see the current registry, in order. See the vignette How gargle gets tokens for a full description of token_fetch().

Usage

token_fetch(scopes = NULL, ...)

Arguments

scopes

A character vector of scopes to request. Pick from those listed at https://developers.google.com/identity/protocols/oauth2/scopes.

For certain token flows, the "https://www.googleapis.com/auth/userinfo.email" scope is unconditionally included. This grants permission to retrieve the email address associated with a token; gargle uses this to index cached OAuth tokens. This grants no permission to view or send email. It is considered a low value scope and does not appear on the consent screen.

...

Additional arguments passed to all credential functions.

Value

An httr::Token or NULL.

See Also

Examples

## Not run: 
token_fetch(scopes = "https://www.googleapis.com/auth/userinfo.email")

## End(Not run)

gargle

Utilities for Working with Google APIs

v1.1.0
MIT + file LICENSE
Authors
Jennifer Bryan [aut, cre] (<https://orcid.org/0000-0002-6983-2759>), Craig Citro [aut], Hadley Wickham [aut] (<https://orcid.org/0000-0003-4757-117X>), Google Inc [cph], RStudio [cph, fnd]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.