Description
This issue explores how to manage refresh tokens with httr2 (linked to #316 questions) created with oauth_flow_auth_code
.
When a website provides a token with a changing refresh token I haven't found a method without requesting confirmation from the user:
oauth_flow_auth_code
: Create a new token, so it needs to be validated again in the browser by the user when updating it.oauth_flow_refresh
: Should not be usedreq_oauth_auth_code
could cache the token but it would revert tooauth_flow_auth_code
when enough time passes.- I haven't find other functions are meant for this kind of authentication.
I was using oauth_flow_refresh
because it was the only way to self-manage the tokens without asking for confirmation from the user. It is unclear to me if req_oauth_auth_code
would overwrite the token store the token too shortly.
In short, I wish to be able to refresh a token and self-manage it.
In addition, I think I was confused by the name of the function req_auth_bearer_token
, which should be used for all tokens. Maybe req_auth
could be a better name if a single function could handle all the token types (without needing to to something like token$access_token
like in the vignettes).
As a summary I made while looking into this, in case someone else finds it helpful:
*: Shouldn't be used except for testing interactively.
Usually the req_auth_* function is only mentioned on the auth_flow_* function help pages. But not the other way around: the req_auth_* do not mention auth_flow_*.