Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
jbaleta
3 years agoExplorer | Level 4
How to use the "App Key" and "App Secret" parameters with the PowerShell Invoke-RestMethod command?
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
- Здравко3 years agoLegendary | 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-DB3 years ago
Dropbox Community Moderator
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:
- https://developers.dropbox.com/oauth-guide
- https://www.dropbox.com/developers/documentation/http/documentation#authorization
- https://dropbox.tech/developers/migrating-app-permissions-and-access-tokens#updating-access-token-ty...
- https://dropbox.tech/developers/using-oauth-2-0-with-offline-access
We recommend using one of the official SDKs whenever possible though, as they'll do most of this work for you.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
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!