cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox 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: 

Switch from one account to another java SDK V2 ?

Switch from one account to another java SDK V2 ?

Aristide
Helpful | Level 7
Go to solution

Hello,

Is there a way to switch from one account to another without revoking the accessToken. Since I migrated to V2 I can not manage several accounts with my app.
I always come back to the same account after:

//previously DbxClientV2 created
dropBoxService = null;
//previously String accessToken created
dropboxAccessToken = null;
//start to create a new one
Auth.startOAuth2Authentication(getActivity(), APP_KEY);
//finaly in on resume method:
dropboxAccessToken = Auth.getOAuth2Token();
                
DropboxClientFactory.init(dropboxAccessToken);
dropBoxService = DropboxClientFactory.getClient();
new GetCurrentAccountTask(dropBoxService, new GetCurrentAccountTask.Callback() {
                    @Override
                    public void onComplete(final FullAccount result) {

                        Log.i("DROPBOX",String.valueOf(result.getEmail()));
                        //i obtain the same previously created email and not a new one! Why?
                        
                    }               

SolidExplorer for example switches from one account to another without losing the accessToken. I can not find the trick.

Thank you.

1 Accepted Solution

Accepted Solutions

Aristide
Helpful | Level 7
Go to solution

This is because the client was not reinitialized in the DropBoxClientFactory.java provided in the android SDK example. Now everything is ok with:

//make sDbxClient public in DropBoxFactory before 
DropboxClientFactory.sDbxClient = null;

View solution in original post

1 Reply 1

Aristide
Helpful | Level 7
Go to solution

This is because the client was not reinitialized in the DropBoxClientFactory.java provided in the android SDK example. Now everything is ok with:

//make sDbxClient public in DropBoxFactory before 
DropboxClientFactory.sDbxClient = null;
Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Aristide Helpful | Level 7
What do Dropbox user levels mean?