You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.

Forum Discussion

PaulELong's avatar
PaulELong
Helpful | Level 6
6 years ago

OAuth2 issues with Dropbox and Xamarin.Auth

I have Xamarin.Auth working with Google drive on Android/iOS/UWP, and I want to add support into my app for Dropbox. Xamarin.Auth is nice because I only have to write the code once, and it handles a ...
  • PaulELong's avatar
    PaulELong
    6 years ago

    I found the solution, but to answer your question first, the text is output from a sniffer trace showing the HTTP Get request.

    And you are right, in that the second response_type and client_id are a duplication.  It confused me and at first I thought it was the HTTP body.  One thing I didn't understand is that GetAuthorizeUri returns the URL plus the params.  Xamarin.Auth requires just the URL, so I can just send "https://www.dropbox.com/oauth2/authorize", and I won't call GetAuthorizeUri at all, since OAuth2Authenticator takes care of building the request.

    The reason there were two response_types where one was code type rather than token type was because I supplied the AccessTokenURL to OAuth2Authenticator, which is not needed in the case of token flow, as I understand.  Since I started with a dropbox API example for .NET and then plugged in each into the OAuth2Authenticator call, I mistakenly sent an AccessTokenUrl.  I found out from looking at the Xamarin code, if AccessTokenUrl==NULL will assume the implict flow (token flow).  Interestingly, and as a note to help others, I tried setting the AccessTokenUrl to null, which caused an exception.  Instead I found this version worked and now I'm authenticating.

    authenticator = new Xamarin.Auth.OAuth2Authenticator(
    clientId: ApiKey,
    scope: "",
    authorizeUrl: new Uri("https://www.dropbox.com/oauth2/authorize"),
    redirectUrl: new Uri(RedirectUri),
    isUsingNativeUI: false) ;

    Hope this information helps somebody else trying to get Xamarin.Auth working with Dropbox.

     

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,918 PostsLatest Activity: 2 days ago
334 Following

If you need more help you can view your support options (expected response time for an email or 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!