add query_authorize_extra optional parameter to drop_auth in order to… #203
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.
Add query_authorize_extra optional parameter to drop_auth in order to allow passing token_access_type = 'offline') to httr::oauth2.0_token
Fixes #201
Dropbox changed their API to only allow short lived tokens by default, which is not usable from a server app (shiny for instance).
Instead, one must generate a refresh_token, and httr already has everything to work with a token generated this way. For the Dropbox API, this means passing an extra argument in the URL: token_access_type = "offline".
This can be done with the query_authorize_extra argument of httr::oauth2.0_token, as explained here. This requires httr 1.4.0.
Then, to generate a token:
token <- drop_auth(query_authorize_extra = list(token_access_type = "offline")
And to refresh: token$refresh().
An interesting addition would be to have rdrop2 manage the token refreshing when needed. It might already be done in httr2, but this would probably require further developments. This commit only addresses the creation of a token that includes both an access token (short lived) and a refresh token (long lived).