Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
Hi All
is it possible (in a test app) to login as user 1, view files etc, then log out and log in as user 2, view their files etc?
My app is using an OAuth2 flow in .net, its a windows forms app.
during the authentication routine, it opens a browser window and presents the login page. the access token is then kept to validate operations.
when logging out, i remove the access token (set to string.empty), in addition - ive also sent a TokenRevokeAsync request. after awaiting that event it loads up the login browser and immediately restores the previous access token.
Im using the Developer API for .net (official)
the method on the login form(browser) that is called, is:
Public Sub Start(ByVal appKey As String)
Me.oauth2State = Guid.NewGuid().ToString("N")
Dim authorizeUri = DropboxOAuth2Helper.GetAuthorizeUri(OAuthResponseType.Token, appKey, New Uri(RedirectUri), oauth2State, False, False)
Me.Browser.Navigate(authorizeUri)
End Subthen:
Private Sub BrowserNavigating(ByVal sender As Object, ByVal e As NavigatingCancelEventArgs)
If (Not e.Uri.ToString().StartsWith(RedirectUri, StringComparison.OrdinalIgnoreCase)) Then
' we need to ignore all navigation that isn't to the redirect uri.
Return
End If
Try
Dim Result As OAuth2Response = DropboxOAuth2Helper.ParseTokenFragment(e.Uri)
If (Result.State <> Me.oauth2State) Then
Return
End If
Me.AccessToken = Result.AccessToken
Me.Uid = Result.Uid
Me.Result = True
Catch eww As ArgumentException
' There was an error in the URI passed to ParseTokenFragment
Finally
e.Cancel = True
newAttempt = False
Me.Browser.Navigate("about:blank") ' nav away
Me.Hide()
End Try
End SubCould anyone suggest anything to make this work?
BTW: on first run, there is no credential stored so i know this is something to do with cached credentials.
@Grek K. thanks, I see your point about inconvenience. I am probably looking at it from a use-case where the user wants to disable the Dropbox integration and be presented with a user login screen when re-enabled again because it is likely to be disabled with the intent to switch users. There is a slight chance that the user may accidentally overlook the small sign-out link on the re-approval page, and still re-approve as the previously signed-in user. So, perhaps, it does make more sense in my app to set 'forceReauthentication'.
Hi there!
If you need more help you can view your support options (expected response time for a ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!