cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
We've been busy working on some major updates to the Community, so check out what's changing, what’s staying the same and what you can expect from the Dropbox Community right here.

Discuss Dropbox Developer & API

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

How to login to dropbox account from inside UWP app?

How to login to dropbox account from inside UWP app?

Aurangzeb
New member | Level 2

Hi.

 

I've moving my Xamarin app to UWP.

In my Xamarin app I use this method of authentication

https://gist.github.com/thomashagstrom/b0856a383bcdcf905c7a774c8c1b0879

The trick is 

webView.Navigating += this.WebViewOnNavigating;

 

But.

In UWP webView has no Navigating event (see https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.webview?view=winrt-18362)

 

So, how can I let user of my app to login to his/her dropbox account from my UWP app?

Can you show me a working example?

 

Aurangzeb.

 

19 Replies 19

evry1falls
Collaborator | Level 8

If I understood you correctly, I think usrs don't log in thier accounts from your app. You simply grant them access to your APP (in app console) in YOUR dropbox account under [App Console].

Greg-DB
Dropbox Staff

In order to allow arbitrary end-users to connect your app to their own Dropbox accounts, you should implement the OAuth app authorization flow. Note however that this should no longer be processed in a web view. This should only be done via the user's system browser, per the documentation.

 

I don't believe we have an example for doing this in UWP in particular, but there is a general example with some code in the DropboxOAuth2Helper class documentation for the official Dropbox API v2 .NET SDK.

evry1falls
Collaborator | Level 8

@Greg-DB wrote:

In order to allow arbitrary end-users to connect your app to their own Dropbox accounts, you should implement the OAuth app authorization flow. Note however that this should no longer be processed in a web view. This should only be done via the user's system browser, per the documentation.

 

I don't believe we have an example for doing this in UWP in particular, but there is a general example with some code in the DropboxOAuth2Helper class documentation for the official Dropbox API v2 .NET SDK.


I think he was asking about something else, I think he wants the user to be able to use the app in order to log into user's personal account including shared files. I don't think this is possible according to OAuth2 which prevent using one's password through token flow method.

Maybe generating a link to the user's account is more suitable. [I guess]

Greg-DB
Dropbox Staff

@evry1falls I'm not sure I understand your comment. The information in my comment does refer to using the OAuth 2 app authorization "token" flow to allow the end-user to connect the app to their own personal Dropbox account, including shared files, without giving their password to the app. Implementing the OAuth 2 app authorization flow to allow end-users to authorize the app is the intended design. 

 

If I understand correctly though, the original question was about how to migrate this flow from a webview in Xamarin to a webview in UWP, but I pointed out that it should actually be processed in the system browser, not a webview. 

evry1falls
Collaborator | Level 8

I'm sorry if I seemed arguemental.

Im sure you know what you are talking about.

evry1falls
Collaborator | Level 8

@Greg-DB wrote:

If I understand correctly though, the original question was about how to migrate this flow from a webview in Xamarin to a webview in UWP, but I pointed out that it should actually be processed in the system browser, not a webview. 


I also changed the original code for my desktop project to display the Auth page in webbrowser control that I use, not the default webbrowser of the machine, it is working fine, I see no reason why you suggested otherwise. Could you explain it more?

Greg-DB
Dropbox Staff

@evry1falls Per the /oauth2/authorize documentation, the Dropbox OAuth app authorization flow should be processed in the system browser, not a web view. There's more information linked there, but in short, this is both to comply with Google's policy (since Dropbox offers Google Sign In as an authentication option), as well as for compatibility with the Dropbox site in general. While it may currently work in the control you're using, we've found web views to be more prone to incompatibilities, and since they're not officially supported by the Dropbox site, we can't promise fixes if/when such issues arise.

evry1falls
Collaborator | Level 8

@Greg-DB wrote:

@evry1falls Per the /oauth2/authorize documentation, the Dropbox OAuth app authorization flow should be processed in the system browser, not a web view. There's more information linked there, but in short, this is both to comply with Google's policy (since Dropbox offers Google Sign In as an authentication option), as well as for compatibility with the Dropbox site in general. While it may currently work in the control you're using, we've found web views to be more prone to incompatibilities, and since they're not officially supported by the Dropbox site, we can't promise fixes if/when such issues arise.


Thank you.

Vasilinka
Helpful | Level 5

May I ask you to send that part of Google's policy that requires DropBox to stop supporting the Web Authentication Broker?

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    Vasilinka Helpful | Level 5
What do Dropbox user levels mean?