I am the developer of the Drupal module Backup & migrate Dropbox that extends the "Backup and migrate" module to store backups on Dropbox. So this module:
- is open source, so I cannot put the App secret in my code.
- installed on web servers of which I cannot know the domain names, so I cannot define redirect uri's for all those domains.
- runs via some admin screens but mainly via cron jobs (unattended), so I need a way to work with long lived tokens/codes.
- I am not part of an organization that can or wants to provide an intermediate site for the redirect uri (and storage of long lived codes/tokens? Keeper of App secret?) .
- The current version requires users to each create their own App and generate a long lived token on their App console.
I am developing a new version that should use the newer oauth2 way of obtaining authorization. Given the above, it seems that the PKCE flow is the way to go, but is this possible? I arrive at getting a user copied and pasted (short lived) acces code, use that to get a 1st (short lived) bearer token and (presumably long lived) refresh token, but after the access code and bearer token have expired and I use the refresh token to get a new bearer token I get the error:
Request sent:
https://api.dropbox.com/oauth2/token
body = refresh_token=8p************************************************************eI
&grant_type=refresh_token
&code_verifier=wE***************************************pU
&client_id=2b***********6x
Response received (invalid json as all \ were removed to improve readability):
body: {"error_description": "unknown field "code_verifier"", "error": "invalid_request"}"
response code: 400Is what I want possible? If so, how? Or what is the way to go?
Thanks for any help on this.