credentials_byo_oauth2: Load a user-provided token
Description
This function does very little when called directly with a token:
Checks that the input appears to be a Google OAuth token, based on
the embedded oauth_endpoint.
Refreshes the token, if it's refreshable.
Returns its input.
There is no point providing scopes. They are ignored because the scopes
associated with the token have already been baked in to the token itself and
gargle does not support incremental authorization. The main point of
credentials_byo_oauth2() is to allow token_fetch() (and packages that
wrap it) to accomodate a "bring your own token" workflow.
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.
# NOT RUN {# assume `my_token` is a Token2.0 object returned by a function such as# httr::oauth2.0_token() or gargle::gargle2.0_token()credentials_byo_oauth2(token = my_token)
# }