cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Not happy with your Spotify Wrapped? Check out how Kevin on the Dropbox team used Paper to make sure he keeps discovering new music over here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
1
Ask
2
Comments

Re: Issue in generating access token

Re: Issue in generating access token

Kloss
New member | Level 2

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?

Re: Issue in generating access token

Greg-DB
Dropboxer

@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.

Re: Issue in generating access token

Здравко
Super Collaborator | Level 20

@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.

Re: Issue in generating access token

astronomy
New member | Level 2

Thank you. Your answer was very helpful to me. It should be in the guide articles.

Re: Issue in generating access token

calexmac
New member | Level 2

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

Re: Issue in generating access token

Greg-DB
Dropboxer

@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.

Need more support?