You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# googlesheets4::gs4_auth()
# or
httr2:::oauth_flow_auth_code_read("state")
summary(cars)
Run All (not knit)
Sends to the R Console:
> # Chunk 1
> # googlesheets4::gs4_auth()
> # or
> httr2:::oauth_flow_auth_code_read("state")
Enter authorization code or URL:
Enter state parameter: # Chunk 2
Error in `httr2:::oauth_flow_auth_code_read()`:
! Authentication failure: state does not match
Run `rlang::last_trace()` to see where the error occurred.
The text was updated successfully, but these errors were encountered:
I like the idea of using rstudioapi::askForPassword() instead of readline() since a modal dialog is harder to miss/ignore. Could also look into askpass which does a similar thing in a more general way.
That doesn't solve the non-interactive case, but I think that has to take a different tack anyway.
While using
oauth_token_cached()
withflow = oauth_flow_auth_code
andcache_disk = TRUE
(as added in #349):Each are the expected behavior, which has been immensely helpful!
But, a nuance we've since realized is that if (2) happens when called indirectly:
gargle
per https://github.com/r-lib/gargle/blob/main/R/oauth-init.R#L133(1) is a side effect of the expected and well-documented behavior of
readline()
that it doesn't necessarily wait for use input at all costs.One option could be using an
rstudioapi
alternate inoauth_flow_auth_code_read()
, but that's not as generalizable:(2) Could likely be offset by changing https://github.com/r-lib/httr2/blob/main/R/oauth-flow-auth-code.R#L145, akin to #171
Here's one way to reproduce (1), to start:
Sends to the R Console:
The text was updated successfully, but these errors were encountered: