Sindbad~EG File Manager

Current Path : /home/numerotech/dropbox.numerotech.com/dropbox_v2/
Upload File :
Current File : //home/numerotech/dropbox.numerotech.com/dropbox_v2/readme.txt

1.Refresh token generate method

link : 
https://stackoverflow.com/questions/70641660/how-do-you-get-and-use-a-refresh-token-for-the-dropbox-api-python-3-x



--------- ---------  --------- --------- --------- ---------

Here is how I did it. I'll try to keep it simple and precise

Replace <APP_KEY> with your dropbox app key in the below Authorization URL

https://www.dropbox.com/oauth2/authorize?client_id=<APP_KEY>&token_access_type=offline&response_type=code

Complete the code flow on the Authorization URL. You will receive an AUTHORIZATION_CODE at the end.

--------- ---------  --------- --------- --------- ---------

you also generate AUTHORIZATION_CODE from offline

run offline_auth.py (find the py file in application ) 

--------- ---------  --------- --------- --------- ---------

Go to Postman and create a new POST request with below configuration

Request URL- https://api.dropboxapi.com/oauth2/token
Authorization -> Type = Basic Auth -> Username = <APP_KEY> , Password = <APP_SECRET> (Refer this answer for cURL -u option)
Body -> Select "x-www-form-urlencoded"
Key	Value
code	<AUTHORIZATION_CODE>
grant_type	authorization_code
After you send the request, you will receive JSON payload containing refresh_token.

{
    "access_token": "sl.****************",
    "token_type": "bearer",
    "expires_in": 14400,
    "refresh_token": "*********************",
    "scope": <SCOPES>,
    "uid": "**********",
    "account_id": "***********************"
}

-------- --------- --------- --------- --------- --------- ---------




In your python application :
----------------------------

import dropbox

dbx = dropbox.Dropbox(
            app_key = <APP_KEY>,
            app_secret = <APP_SECRET>,
            oauth2_refresh_token = <REFRESH_TOKEN>
        )
Hope this works for you too!

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists