Stop requiring a configured oauth client prior to token_fetch()
#186
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #160
The basic idea is to let
token_fetch()
fail for someone who wants the user flow AND who has failed to configure an OAuth client. Then, in thegm_auth()
error message, try to provide enough info to help that user diagnose their problem.Previously an OAuth client was required, unconditionally, prior to calling
token_fetch()
. The upside is that the user who wants the user flow gets an unequivocal early error message if they haven't configured a client. And this is by far the most common use case.But the downside is that no other auth flow can work. No BYO token, no service account, no ADC, etc. None of those even need an OAuth client, but they are currently inaccessible because of the unconditional client check. So that has to change.
Here I remove the unconditional check for an OAuth client and, instead, insert specific advice in the
gm_auth()
error message.While I was working on the message, I also added advice about setting
options(gargle_verbosity = "debug")
.This change also makes it easier to auth with the dev/testing credentials, which uses BYO token.