Forum Discussion

ronalddy1's avatar
ronalddy1
New member | Level 2
6 years ago

Python SDK DropboxTeam.as_user throws BadInputException app_key is required to refresh tokens

dbx_t = dropbox.DropboxTeam(
    oauth2_refresh_token=refresh_token, 
    app_key=app_key, 
    app_secret=app_secret 
) 
admin = dbx_t.team_token_get_authenticated_admin()
dbx_t.as_user(admin.admin_profile.team_member_id)

this raises

File "venv/lib/python3.6/site-packages/dropbox/dropbox.py", line 715, in as_user
    team_member_id)
File "venv/lib/python3.6/site-packages/dropbox/dropbox.py", line 739, in _get_dropbox_client_with_select_header
    headers=new_headers,
File "venv/lib/python3.6/site-packages/dropbox/dropbox.py", line 185, in __init__
    raise BadInputException("app_key is required to refresh tokens")
dropbox.dropbox.BadInputException: app_key is required to refresh tokens

Am I using DropboxTeam.as_user incorrectly?

I looked into the code at dropbox/dropbox.py line 739. It seems like the app_key and app_secret arguments are not passed to the new Dropbox instance.

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!