-
Notifications
You must be signed in to change notification settings - Fork 64
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
OAuth docs #334
OAuth docs #334
Conversation
Co-authored-by: Maximilian Girlich <maximilian.girlich@metoda.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that now most of the documentation has moved to the req_oauth_auth_code
help page and then some sections reused in other pages (But there are some missing the cache section).
I see oauth_flow_auth_code_url
is now internal but not oauth_flow_auth_code_listen
, oauth_flow_auth_code_parse
or oauth_flow_auth_code_pkce
. I'm not sure if this was on purpose or not.
I've left some comments in the vignette.
There is also a comment on a help page that hasn't changed in this PR, but I think it is in line with the title of the PR, and might help too other readers.
Thanks for keeping me in the loop.
I tried building the pkgdown to easily review the changes but I couldn't build it:
pkgdown::build_site()
## ...
## Reading 'vignettes/httr2.Rmd'
## -- RMarkdown error -------------------------------------------------------------
##
## Quitting from lines 35-37 [unnamed-chunk-2] (httr2.Rmd)
## --------------------------------------------------------------------------------
## Error:
## ! in callr subprocess.
## Caused by error in `map(.x, .f, ..., .progress = .progress)`:
## ! In index: 3.
## ℹ See `$stdout` for standard output.
## Type .Last.error to see the more details.
Thanks @llrs! All the flows that can use caching should have the caching section, but quite a few don't support caching. FWIW it's not the functions that are internal or doc, but the doc page, and all those functions are documented together. |
#Conflicts: # NEWS.md
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great to see more OAuth docs!
Before reviewing I re-read my own blog post and saw that in a comment I had wondered whether things would be simpler with httr2 😉 r-hub/blog#155 (comment)
I added a few comments.
This is going to be painful, but unfortunately there's no way around it. | ||
I recommend using `with_verbosity()` so you can see exactly what httr2 is sending to the server. | ||
You'll then need to carefully compare this to the API documentation and play "spot the difference". | ||
You're very welcome to file an issue and I'll do my best to help you out. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also point to the community forum? it might be less intimidating.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Less intimidating, but I don't read them so also less helpful 😆
R/oauth-flow-auth-code.R
Outdated
#' | ||
#' Learn more about the overall OAuth authentication flow in `vignette("oauth")`. | ||
#' | ||
#' # Caching |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this reminds me of one topic that is often a hurdle: how to use OAuth on a server, how to provide the token (maybe just a link to https://gargle.r-lib.org/articles/managing-tokens-securely.html since it shows the idea)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great! It balances "oauth is hard and weird" vs "don't be afraid to play with it" well.
Co-authored-by: Jon Harmon <jonthegeek@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even better! My biggest stumbling block learning oauth was getting past "But why are there all these steps???" The hierarchy of tokens helps with that quite a lot! Maybe mention "authorization code" in there as well (as the super short-lived but most capturable one)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very useful new section! I added a few more comments, in particular about the refresh token.
Co-authored-by: Jon Harmon <jonthegeek@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a couple typos.
Co-authored-by: Jon Harmon <jonthegeek@gmail.com>
The process varies from API to API, but at the end of it you'll get a client id and in most cases a client secret. | ||
The first step in working with any OAuth API is to create an **application** **client**. | ||
It's called an application client because in the wider world OAuth is usually used with a web, phone, or tv app, but here your "app" is going to be your R package. | ||
For this reason, httr2 calls the application client a **client**, but many APIs will call it an OAuth application. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW it feels like Google thinks of "your piece of software / your project" as the application and then that application might make use of multiple clients, e.g. a desktop client, a web client, etc.
The vocabulary is sort of a nightmare, so, yeah, the main point is preparing an R user to not recognize themselves or their use case in any of the documentation.
Co-authored-by: Jennifer (Jenny) Bryan <jenny.f.bryan@gmail.com>
#Conflicts: # NEWS.md # man/paginate_req_perform.Rd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in news. I think I got the correct name for the deprecated function.
|
||
* httr2 now informs the user when a token is cached. | ||
|
||
* `req_perform_stream()` replaces `req_perform_stream()`. `req_perform_stream()` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* `req_perform_stream()` replaces `req_perform_stream()`. `req_perform_stream()` | |
* `req_perform_stream()` replaces `req_stream()`. `req_stream()` |
To do:
cache_key
andcache_disk
to end of arg listFixes #330