cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to know what we learned at IBC? Check out our learnings on media, remote working and more right 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: 

How to use the "App Key" and "App Secret" parameters with the PowerShell Invoke-RestMethod command?

How to use the "App Key" and "App Secret" parameters with the PowerShell Invoke-RestMethod command?

jbaleta
Explorer | Level 4

Good afternoon.

 

I am currently connecting to Dropbox via PowerShell using the Invoke-RestMethod command and using the "Generated Access Token". Currently the problem that I am presenting is that daily the "Generated access token" changes and I have to modify the PowerShell Script. Is there a way that I can use another parameter or token that doesn't change?

 

I was also checking the parameter "application key" and "App secret". But I haven't figured out how to use it with PowerShell's Invoke-RestMethod command.

 

I hope you can help me.

 

Cordially,

 

Jairo Baleta

2 Replies 2

Здравко
Legendary | Level 20

@jbaleta wrote:

... Is there a way that I can use another parameter or token that doesn't change?

...


Hi @jbaleta,

Yes and No. Yes - You can use refresh token - a non expiring token that you can use till revoke. Access token expires; it stay valid for ~4 hours. No - to call regular API access points you need access token, so you cannot "throw out" it completely. Using refresh token you can regenerate new access token whenever needed and the existing access token, if any, already expired. As a walkthrough you can take a look here for 'curl' example; I believe you can 'translate' it to whatever web query tool syntax.

Hope this gives direction.

Greg-DB
Dropbox Staff

@jbaleta Здравко is correct; for long-term access, you should use a refresh token. Refresh tokens don't expire and can be re-used repeatedly without manual user interaction. It's not possible to automatically access an account using only the app key and secret. You can find more information in the following resources:

We recommend using one of the official SDKs whenever possible though, as they'll do most of this work for you.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    Здравко Legendary | Level 20
What do Dropbox user levels mean?