Forum Discussion

eisoft's avatar
eisoft
New member | Level 2
3 years ago

i can't get the refresh_token

my aceess token has expired 😞

and i can't get the refresh_token

 

I'm trying to backup to dropbox using access token via curl on linux. However, the access token automatically expires after about 5 hours, and renewal access codes cannot be issued.

 

I checked using the code below. But still refresh_token is not visible.

 

curl https://api.dropbox.com/oauth2/token \ -d code=<AUTHORIZATION_CODE> \ -d grant_type=authorization_code \ -d redirect_uri=<REDIRECT_URI> \ -u <APP_KEY>:<APP_SECRET>

 

This is the code result. refresh_token could not be found.

 

{"access_token": "MYACCESSCODE", "token_type": "bearer", "expires_in": 14400, "scope": "account_info.read files.content.read files.content.write files.metadata.read files.metadata.write sharing.read sharing.write", "uid": "MYIUIDCODE", "account_id": "dbid:MYDBID"}

 

how can i get the refresh_token?

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    In order to get a refresh token, you need to request "offline" access when starting the app authorization flow, which you can do by setting 'token_access_type=offline' on /oauth2/authorize.

     

    You can find more information in the OAuth Guide and authorization documentation. There's a basic outline of processing this flow in this blog post which may serve as a useful example.