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.

Discuss Dropbox Developer & API

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

How to add force_reapprove to the sdk.js

How to add force_reapprove to the sdk.js

paevans
Explorer | Level 4
Go to solution

I'm having trouble with adding the force_reapprove to my code when using the sdk js package. When a user is already logged in I don't want it to skip the process of app consent just in case my user has more than one dropbox account they want to use with my app. 

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

The official Dropbox JavaScript SDK doesn't have the 'force_reapprove' option built in, but I'll pass this along as a feature request. I can't promise if or when that might be implemented though.

 

You should be able to add that to the URL returned by getAuthenticationUrl though. Can you share what you have so far, and what specifically you're having trouble with?

View solution in original post

3 Replies 3

Greg-DB
Dropbox Staff
Go to solution

The official Dropbox JavaScript SDK doesn't have the 'force_reapprove' option built in, but I'll pass this along as a feature request. I can't promise if or when that might be implemented though.

 

You should be able to add that to the URL returned by getAuthenticationUrl though. Can you share what you have so far, and what specifically you're having trouble with?

paevans
Explorer | Level 4
Go to solution
const dropboxUrl = async () => {
const authUrl = await dbx.auth
.getAuthenticationUrl(
redirectUri,
null,
'code',
'legacy',
null,
'none',
false,
)
.then(authUrl => `${authUrl}&force_reapprove=true`);
return authUrl;
};
 
I took your suggestion and was able to get it working! Thank you for your help! 

Greg-DB
Dropbox Staff
Go to solution

I'm glad to hear you were able to get it working already.

 

For reference though, it's technically safer to parse the URL and set the parameter, instead of just adding it as a string. For instance, you could do something like:

var modifiedAuthUrl = new URL(authUrl);
modifiedAuthUrl.searchParams.set('force_reapprove', true);
modifiedAuthUrl = modifiedAuthUrl.href;

 

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    paevans Explorer | Level 4
What do Dropbox user levels mean?