Forum Discussion

liu-yuxin98's avatar
liu-yuxin98
Explorer | Level 3
4 years ago

Re: Oauth2 refresh token question - what happens when the refresh token expires?

May I know what is the " auth_code" here. how can I get it?

 

authorize_url = auth_flow.start()
print("1. Go to: " + authorize_url)
print("2. Click \"Allow\" (you might have to log in first).")
print("3. Copy the authorization code.")
auth_code = input("Enter the authorization code here: ").strip()

try:
oauth_result = auth_flow.finish(auth_code)
except Exception as e:
print('Error: %s' % (e,))
exit(1)

2 Replies

  • FrustratedUser3's avatar
    FrustratedUser3
    Collaborator | Level 8
    4 years ago

    When you run the script, a link is provided to you via the console, which you have to paste into a browser window. Once you go to the link, a code is provided. That code is the auth_code, which has to be pasted into the console to finish the authentication sequence.

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    4 years ago

    That's correct, the "auth_code" variable there should contain the "authorization code", which is a single-use code from the app authorization page that the app then exchanges for an access token and optional refresh token, by calling /oauth2/token. I recommend reading the OAuth Guide and authorization documentation for more information.

About Dropbox API Support & Feedback

Node avatar for 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!