Ziscom 18
Ziscom 18

Reputation: 46

Dropbox access token without logging in

How to generate Dropbox access token without logging in button.

I have created method to setup oauth2. However it demands to login every time to get a new access token and to refresh oauth2 after every 4 hours. I want to automate this process.

Upvotes: 0

Views: 97

Answers (1)

Inderjeet Singh
Inderjeet Singh

Reputation: 187

Oauth2 access token can be refreshed using a separate API call, using refresh token. Refresh token is long lived, while access token is short lived.

curl --location 'https://api.dropbox.com/oauth2/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=refresh_token' \
--data-urlencode 'refresh_token=<REFRESH_TOKEN>' \
--data-urlencode 'client_id=<APP_KEY>' \
--data-urlencode 'client_secret=<APP_SECRET>'

You can regenerate access token every time you need it, from within code, rather than using the logins.

Upvotes: 1

Related Questions