cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Get summer ready with Dropbox basic - travel documents, plans, progress reminders and more, right over 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: 

Store Multiple Access Tokens

Store Multiple Access Tokens

qazimuneeb1
Explorer | Level 3

Hi. I am building an android app which uses dropbox api to connect to dropbox through auth flow and then upload files on dropbox, I want to store my access token for each account into the database so that with multiple accounts i have access tokens for each account, I am doing this because i do not want to generate new tokens each time the user logs in with different account. My problem is that i have to store access token against an account in the database so that i know that which access token belongs to which account, so for that i must have a unique id for each account which should not be change in future so that i can differentiaite between accounts. I have researched and get this method i.e 

Auth.getUid();

it returns me a numeric value. I want to ask what is this method and can i use this value to differentiate between accounts and store my access token againts this value for each account? or anyother solution! 

1 Accepted Solution

Accepted Solutions

Re: Store Multiple Access Tokens

Greg-DB
Dropboxer

That returns the user ID from the authorization flow. The user ID does identify the particular Dropbox account and is stable for the account, so you can technically use that. Preferably though, you should use Account.accountId as returned by getCurrentAccount. That also uniquely identifies the Dropbox account and is stable. The account ID is recommended over the user ID.

View solution in original post

4 Replies 4

Re: Store Multiple Access Tokens

Greg-DB
Dropboxer

That returns the user ID from the authorization flow. The user ID does identify the particular Dropbox account and is stable for the account, so you can technically use that. Preferably though, you should use Account.accountId as returned by getCurrentAccount. That also uniquely identifies the Dropbox account and is stable. The account ID is recommended over the user ID.

Re: Store Multiple Access Tokens

qazimuneeb1
Explorer | Level 3

Thanks Greg! Looking forward to achieve this target 🙂

Re: Store Multiple Access Tokens

qazimuneeb1
Explorer | Level 3

One thing more that where to call this method to get accountId? 

Re: Store Multiple Access Tokens

Greg-DB
Dropboxer

To retrieve the account ID, you should call the getCurrentAccount method. There's an example of doing so here. You can make that call wherever/whenever you need in your app, e.g., when you need to get the account ID when first storing the access token, etc.

Poll
Which Dropbox Plan do you have?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropboxer
  • User avatar
    qazimuneeb1 Explorer | Level 3
What do Dropbox user levels mean?
Need more support?