Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
Hello, I faced many issues in generating access token
First, I have here access code generated <REDACTED>Second trying to execute this curl :
curl https://api.dropbox.com/oauth2/token \ -d code=<REDACTED> \ -d grant_type=authorization_code \ -d redirect_uri=https://api.dropbox.com/oauth2/token \ -u <REDACTED>
It prints every time :
{
"error": "invalid_grant",
"error_description": "redirect_uri mismatch"
}
However I have here the redirected links
I was able to get my access code generated.
Then i open terminal as admin - and do the curl command replacing the app key and app secrete and inserting the access code.
Red XXXXX below are my account codes but replaced with xxxxx's
However I get a red error in Terminal. it says
Invoke-WebRequest : Parameter cannot be processed because the parameter name 'u' is ambiguous. Possible matches include: -UseBasicParsing -Uri -UseDefaultCredentials -UserAgent.
At line:1 char:128
+ ... xxxxxxxxxxxxxxxxxxxx -d grant_type=authorization_code -u xxxxxxx ...
+ ~~
+ CategoryInfo : InvalidArgument: (:) [Invoke-WebRequest], ParameterBindingException
+ FullyQualifiedErrorId : AmbiguousParameter,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
:EDIT:I googled and found article to do the following command inside Terminal to fix this issue. - That seemed to work so I'll paste it here for anyone else who runs into this issue on Windows 11.
Remove-item alias:curl
Now I'm stuck at the message
"Enter host password for user 'xxxxxxxxxxxxxxxxxxxxxxxxx':
I've Typed password - I've copy pasted but the error I keep getting is
{"error": "invalid_client: Invalid client_id or client_secret"}
I know my app key and app secret is correct. And the host password I assume is my dropbox password to get into my account.
any thoughts on this?
@Kloss The original "-u" option shown earlier in this thread is an option for curl for specifying the Basic credentials (which in this case should be the app key and secret). It looks like in your environment it was getting sent to Invoke-WebRequest, where "-u" is ambiguous. I'm glad to hear you already sorted that out.
For this /oauth2/token call, you would specify the app key and secret, but not your account password. The "-u" option is a way to specify the app key and secret, in place of what would be the username and password in other contexts. So, to specify the app key and secret, you could use it like "-u <appkey>:<appsecret>", where <appkey> is your app key, and <appsecret> is your app secret; do not enter your account password.
@Kloss wrote:...
I know my app key and app secret is correct. And the host password I assume is my dropbox password to get into my account.
...
@Kloss, your account id (email) or password have nothing to do here! The only thing you need to authenticate is your application, nothing more. Check your shell syntax (might be some typing error, for instance). You account identification has already been performed in your browser. 😉
Good luck.
Thank you. Your answer was very helpful to me. It should be in the guide articles.
Hi Здравко
I have followed your (very generous) steps. Every works fine... I get back the JSON I am expecting as per your post. ie I get the access token, a refresh token and bunch of other data. However when I use the 'sl...' access token just generated to upload a file, I get the following error:
{"error_summary": "expired_access_token/...", "error": {".tag": "expired_access_token"}}
I have tried the flow you recommend several times to ensure I have all inputs correct, and get the same error.
Then I tried generating an access token directly from the app console for the app. This returned the same error.
Any thoughts on where I should focus?
tx
c
@calexmac An 'expired_access_token' error indicates that the particular short-lived access token you used has expired, so you'd need to get a new one to continue making API calls. If you have a refresh token, you can do so by calling /oauth2/token with grant_type=refresh_token. Please refer to the messages at the beginning of this thread for more information.
Does this method still work until now?
Yes @The Kingdom, it does. It has never stopped. 😉 Do you have any issue? 🧐
Nice New Year holiday for everybody!
Hm.. 🤔 To be honest, I'm not sure what you ask me for. API/SDKs are software tools directed for usage in software project (or even simple client script). This is valid for any kind of such tools (no limit to Dropbox API/SDK). In the same context you need some basic coding skills, at least! My example here shows how authentication can work in a very basic and simplistic way. It's not the only way. The same way can be used for some prebuild third party software, but better ask the software provider how exactly, if you don'f feel yourself confident enough.
Hope this gives direction.
Hi there!
If you need more help you can view your support options (expected response time for a ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!