I think httr or httr2 could try a bit harder to figure out if oob auth is necessary. Dumping some notes I initially made in https://github.com/r-lib/gargle/issues/102, but ultimately decided that httr[2]was a better place to implement this.
We could make the default logic for oob auth a bit more humane.
For example, we could determine that we are on RStudio Server and use oob auth, w/o having to receive explicit instructions via the option or arg.
How to tell?
rstudioapi::versionInfo()$mode
[1] "server"
Also, since I'm here, let me record other ways I know of learning more about context: The env var R_CONFIG_ACTIVE is "shiny" on shinyapps.io and "rstudio_cloud" on RStudio Cloud.
When you're in RStudio, you can call RStudio.Version(). But that's a function attached by RStudio itself and would presumably require weird gymnastics in a CRAN package.
RStudio v1.3 will set RSTUDIO_PROGRAM_MODE.
RSTUDIO_HTTP_REFERER is set in RStudio Server but not in Desktop.
I think httr or httr2 could try a bit harder to figure out if oob auth is necessary. Dumping some notes I initially made in https://github.com/r-lib/gargle/issues/102, but ultimately decided that httr[2]was a better place to implement this.
We could make the default logic for oob auth a bit more humane.
For example, we could determine that we are on RStudio Server and use oob auth, w/o having to receive explicit instructions via the option or arg.
How to tell?
Also, since I'm here, let me record other ways I know of learning more about context: The env var
R_CONFIG_ACTIVE
is"shiny"
on shinyapps.io and"rstudio_cloud"
on RStudio Cloud.When you're in RStudio, you can call
RStudio.Version()
. But that's a function attached by RStudio itself and would presumably require weird gymnastics in a CRAN package.RStudio v1.3 will set
RSTUDIO_PROGRAM_MODE
.RSTUDIO_HTTP_REFERER
is set in RStudio Server but not in Desktop.