MarkEdmondson1234 / googleAuthR

Google API Client Library for R. Easy authentication and help to build Google API R libraries with OAuth2. Shiny compatible.
https://code.markedmondson.me/googleAuthR
Other
175 stars 51 forks source link

Pass ellipsis from `gar_auth(...)` to `gargle::token_fetch(...)` #164

Closed octaviancorlade closed 4 years ago

octaviancorlade commented 5 years ago

This allows to pass any parameter to any of the default functions used by token_fetch, for instance it works with offline refresh tokens as follows

gar_auth_configure(app = oauth_app("google", key = client.id, secret = client.secret))
gar_auth(credentials = list(refresh_token = "1//refresh-token-here"))
MarkEdmondson1234 commented 5 years ago

I'm just thinking about this to make sure no issues, I'm a bit cautious of ... as it can lead to some weird bugs for people if they use an old argument etc.

octaviancorlade commented 5 years ago

That is correct, also it will make it harder to add new options to gar_auth in case those could be used already by token_fetch. The code was there and I wasn't sure how big these issues could be so I opened this, but it can be closed if needed. Calling token_fetch explicitly also works and is fairly easy

gar_auth_configure(app = oauth_app("google", key = client.id, secret = client.secret))
token = token_fetch(app = gar_oauth_app(), credentials = list(refresh_token = "1//refresh-token-here")
gar_auth(token)
MarkEdmondson1234 commented 4 years ago

I think this may cause problems down the line, would rather arguments are passed through explicity, or perhaps a config object to avoid too many parameters.