cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
What’s new: end-to-end encryption, Replay and Dash updates. Find out more about these updates, new features and more here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

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

liu-yuxin98
Explorer | Level 3

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 2

FrustratedUser3
Collaborator | Level 8

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
Dropbox Staff

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.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    FrustratedUser3 Collaborator | Level 8
What do Dropbox user levels mean?