Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
Bilal L.
11 years agoNew member | Level 1
authentication error
Following is the the code from dropbox tutorials
from dropbox.client import DropboxOAuth2FlowNoRedirect, DropboxClient
from dropbox import rest as dbrest
auth_flow = DropboxOAuth2FlowNoRedirect('r********', 'r***********')
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: ')
try:
access_token, user_id = auth_flow.finish(auth_code)
except (dbrest.ErrorResponse) as e:
print('Error: %s' % (e,))
c = DropboxClient(access_token)
i get the following response
Error: [400] 'invalid_client' Traceback (most recent call last):
File "test2.py", line 17, in c = DropboxClient(access_token) NameError: name 'access_token' is not defined
7 Replies
Replies have been turned off for this discussion
- Leah C.111 years agoNew member | Level 1
Hi - did you create a new app in the App Console? https://www.dropbox.com/developers/apps
Are you then using the correct app key and app secret when setting up yourDropboxOAuth2FlowNoRedirect? - Malani S.11 years agoNew member | Level 1
yes all those steps are perfectly ok. i created the app and got the app and secret keys from there, passed the keys to DropboxOAuth2FlowNoRedirect. after i got the url, i copied it and paste the link in browser to allow and got the code there. I copied the code from website and paste it on the screen asking for authentication key. but finish() generates an error that key is invalid.
- Leah C.111 years agoNew member | Level 1
It could be an issue with extra whitespace when copying the access token from the web browser.
It may help to print out the full error body like so:
try: access_token, user_id = flow.finish(code) except dropbox.rest.ErrorResponse as err: print err.body - Malani S.11 years agoNew member | Level 1
Error:
Go to: https://www.dropbox.com/1/oauth2/authorize?client_id=r27dk6ovnuj2u58&r esponse_type=code 2. Click 'Allow' (you might have to log in first). 3. Copy the authorization code. Enter the authorization code here: CuItA**************** (a 43 digit number) CuIt**************** (a 43 digit number) {'error_description': 'Invalid client_id or client_secret', 'error': 'invalid_client'} Traceback (most recent call last): File "test2.py", line 17, in <module> c = DropboxClient(access_token) NameError: name 'access_token' is not defined - Steve M.11 years ago
Dropbox Staff
My guess would be that your app secret is incorrect. Make sure that the app secret you're using in your code (the second parameter to the
DropboxOAuth2FlowNoRedirectconstructor) matches the one found on the app console. - Alison S.1110 years agoNew member | Level 1
Yes, when I had this issue the app secret was incorrect. Dropbox's page with the app secret won't let you copy it to your clipboard! :( Originally my app_key and app_secret were the same because it didn't copy correctly and didn't cause an error.
You have to type the app_secret manually into your code and hope you don't make a mistake and/or check it 10 times.
- Steve M.10 years ago
Dropbox Staff
Alison, can you explain what you mean when you say "Dropbox's page with the app secret won't let you copy it to your clipboard?" What exactly did you try and what issue did you run into? (And what OS and browser were you using?)
For me, I just need to click the "show" button to reveal the secret, and then I can highlight it and copy it like any other text on the page.
About 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!