cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Find out how Tiffany, a Customer Experience superstar uses Dropbox to keep her family in the loop when it comes to her new baby 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

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

Re: How to add force_reapprove to the sdk.js

Greg-DB
Dropboxer

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

Re: How to add force_reapprove to the sdk.js

Greg-DB
Dropboxer

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

Re: How to add force_reapprove to the sdk.js

paevans
Explorer | Level 4
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! 

Re: How to add force_reapprove to the sdk.js

Greg-DB
Dropboxer

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;

 

Who's talking

Top contributors to this post

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