Search code examples
uwpoauthdropbox

UWP: WebAuthenticationBroker.AuthenticateAsync not working for dropbox?


The method WebAuthenticationBroker.AuthenticateAsync from the Windows.Security.Authentication.Web namespace seems to work for Google, but not for Dropbox. For Dropbox, it shows "Can't connect to the service".

Fastest way to reproduce (for UWP and Xamarin.UWP):

Use var requestUri = new Uri("https://dropbox.com/oauth2/authorize?dummyQueryString"); in a call with

var response = await WebAuthenticationBroker.AuthenticateAsync(WebAuthenticationOptions.None, requestUri, new Uri("dummycallbackUri:/"));

This results in:

Can't connect so the service

Calling it with

var requestUri = new Uri("https://accounts.google.com/o/oauth2/auth?dummyQueryString");

results in Google-content being displayed (a 400 Bad Request, but that is as expected with a dummy query string).

I tested another random requestUri "https://stackoverflow.com/" that has nothing to do with OAuth, I get:

Sorry, we no longer support Internet Explorer

This last example may provide some information on how the WebAuthenticationBroker works... is it really using an old browser while I'm using the latest version of Mozilla FireFox as my default browser?

How can I use WebAuthenticationBroker.AuthenticateAsync for Dropbox?


Solution

  • I can't speak to why it's showing an error instead of the page, but Dropbox doesn't officially support processing the OAuth app authorization flow in a web view like this (per docs), so you should send this through the system browser instead anyway.

    These web views sometimes do use old browser engines instead of whatever you have installed as your system browser, so they are more prone to compatibility issues like that.