-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve OAuth docs #330
Comments
In general, you shouldn't be using any I think the big question here is why you want to self-manage tokens — that really fights against the goal of httr2 to do that for you. (And in general, I don't think you can provide a good user experience when self-managing tokens because you need to be able to automatically re-auth if a token expires, and that has to be done by httr2 since it's in the middle of the request flow.) Could you give me a high level view of what you're trying to achieve so that I can steer you in the right direction? |
I want to self-manage tokens because 1) with httr is what I used to do, 2) with a changing refresh token until #232 there was no way for httr2 to handle it, so I had to implement it myself, 3) because from the vignette I understood that I used to re-auth automatically before hitting the API by requesting a fresh token and replacing the old one to store the new refresh token. If not possible, I requested a new token before making the call to the API. As noted in #319, it used to work. I see I made several bad decisions because I didn't understood correctly the documentation. Apologies for all the opened issues in these days |
I don't think it's your problem; it's mine — I seem to have failed to document how I expect folks to actually do OAuth, which has lead to a lot of confusion. I'll see what I can do to improve the documentation — I think it probably makes sense to document (e.g.) |
Thoroughly review docs and the vignette. Fixes #330.
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 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 ifreq_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. Maybereq_auth
could be a better name if a single function could handle all the token types (without needing to to something liketoken$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_*.
The text was updated successfully, but these errors were encountered: