tidyverse / googledrive

Google Drive R API
https://googledrive.tidyverse.org/
Other
322 stars 47 forks source link

Documentation request: Is drive_deauth the opposite of drive_auth? #412

Closed MichaelChirico closed 1 year ago

MichaelChirico commented 1 year ago

I am writing tests and would like a set/unset workflow like:

test_that("", {
  set_auth(...)
  on.exit(unset_auth())
})

I assume drive_auth() and drive_deauth() fit the bill, but was thrown a bit by the description in ?drive_deauth:

This can be used to access public resources for which no Google sign-in is required. This is handy for using googledrive in a non-interactive setting to make requests that do not require a token.

This makes it sound like they are more used for a different purpose, rather than for the flow I had in mind (re-setting state after a test). It would be helpful for the documentation to be more explicit here.

If they are opposites, it might also be useful to offer a withr-esque pair of helpers useful for tests, i.e. with_auth(...) and local_auth(...).

If they are not opposites, it would be helpful to call this out in the documentation, and suggest alternatives / allude to why it may be difficult to un-set authorization in a given R session.

jennybc commented 1 year ago

I've just re-read this cluster of issues and I still feel as I did when I closed the bigrquery issue. I'm OK with the docs as they are. I think this pair of functions just doesn't do what you were hoping it did.