I need to log in a user into Dropbox using Core API. Then remember his/her access token and allow logging in with another credentials (looks like a second Dropbox user). But when I make request to https://www.dropbox.com/1/oauth2/authorize it automatically ends up with redirect page with first user's access token giving no chance to enter another credentials. I know I can revoke first access token but then I will not be able to silently come back to first user. Does anyone know is the possible to implement?
1 Answer
You can set the force_reapprove parameter for the /authorize page to true to prevent the automatic redirect:
https://www.dropbox.com/developers/core/docs#oa2-authorize
Note that the /authorize page is hosted on www.dropbox.com though, so the user will get their www.dropbox.com session, even if force_reapprove=true is set. With that parameter set though, the user has the opportunity to switch accounts, using the dropdown in the upper right of the page, before authorizing the app.
If that's not sufficient for whatever reason, you can try to end the user's www.dropbox.com. The simplest way is to direct them to www.dropbox.com/logout first. Be sure to make it clear to the user what is happening though.
Or, if you control the entire browser, e.g., if it's an embedded web view in your app, you can clear the browser's cookies, which will clear the session, forcing users to log in again.
-
thanks but I to need re-enter user login/password - not re-approve– andriiCommented Feb 16, 2016 at 8:17
-
Using
force_reapprove=truegives the user the opportunity to switch accounts and enter the credentials for another account, before approving the app.– GregCommented Feb 16, 2016 at 15:33 -
Yes but is there any more straight forward way? With your suggestion user should guess to look to the upper right corner and sign-out there. Most of users IMHO will just authorize the app again– andriiCommented Feb 16, 2016 at 23:30
-
-
I read a lot about that Dropbox stores something on server side so it always applies recent user login, so neither disable_token nor closing connections works. BUT when I restart my app going to dropbox.com/1/oauth2/authorize the link is not redirected so empty authentication page is shown (what I actually need). So there is the way app can get empty auth page. Dear Dropbox specialists, please give me more details on why it works this way so I could emulate this without restarting the app.– andriiCommented Mar 11, 2016 at 10:58