cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Check out the Dropbox cheat sheet for getting started in 2021 here!

Discuss Dropbox Developer & API

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

Getting wrong access token

Getting wrong access token

Explorer | Level 3

Hi Team,

We have a web application in which we asks users to provide App Key and App Secret. After that we generate the access token and proceed ahead with our logic.

Recently, we faced a weird issue, we obtained App Key and App Secret from the app created in Dropbox X.

We opened up the web application in a browser where we are logged into a Dropbox Y account.

Now, while authorizing through the obtained App Key and App Secret which is from Dropbox X, it gives the access token of the App created in Dropbox Y.

Could you please help us with what could be wrong?

We are using /oauth2/authorize to obtain the access token.

Thanks in advance for your help!

Regards,

Sam

1 Reply 1

Re: Getting wrong access token

Dropboxer

Thanks for the report. If I understand your message correctly though, this is the expected behavior, but please let me know if I've misunderstood or misread your message.

The account that "owns" an API app (and correspondingly owns its app key and secret), that is, the account that registered that API app, is not necessarily going to be the same as the account that any particular access token for that app allows access to.

Put another way:

  • app key and secret: identify a particular app, and each app is "owned" by one account, but do not themselves enable access to any account
  • access token: identifies a particular app and user pair, but the user is not necessarily the same as the app owner above

So, regardless of who registered the app in the first place, the resulting access token is going to be connected to the account that was signed in and authorized the app on the /oauth2/authorize page.

One potential point of confusion here is where you said "it gives the access token of the App created in Dropbox Y.". Do you mean that Dropbox Y also registered an API app, and that the resulting access token is for that app? If so, how are you checking that? The access token in this scenario should be for Dropbox account Y, but for the app owned by Dropbox account X.

By the way, we generally don't recommend having users register their own apps to get their own app keys and secrets. You as the developer of the app should just do that once per app, and use the resutling app key and secret in your app, in order to get access tokens for any end-users using your app. (Once in production mode, a single app can be used by any number of users.)

Polls
Are you starting new work habits this year?

Work Smarter with Dropbox

The way we work is changing. Share and discover new ways to work smarter with Dropbox in our community.

Sound good? Let's get started.
Who's talking

Top contributors to this post

What do Dropbox user levels mean?
Need more support?