2

I'm getting "The specified protocol is unknown." while getting token from MS OAuth. I can provide the user name and password OK. Get "Unknown Protocol Error" error after "Let this app access your info?" screen.

I use the following code:

Uri StartUri = new Uri("https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=" + Uri.EscapeDataString(ClientID) + "&redirect_uri=" + Uri.EscapeDataString(CallbackUrl) + "&response_type=code&response_mode=query&scope=" + Uri.EscapeDataString(ScopeUrl);

Uri EndUri = WebAuthenticationBroker.GetCurrentApplicationCallbackUri(); 

WebAuthenticationResult WebAuthenticationResultCode = await WebAuthenticationBroker.AuthenticateAsync(WebAuthenticationOptions.None, StartUri, EndUri);

Tried also WebAuthenticationOptions.UseTitle, same problem.

Same code works for Google (with WebAuthenticationOptions.UseTitle and EndUri "https://accounts.google.com/o/oauth2/approval?")

I'm using Universal app project in VS 2015.

This older post resolved the issue by changing web authentication options, but it does not seem to work for me on Win 10: Exception thrown when WebAuthenticationBroker receives an OAuth2 callback

Any help appreciated, I'm out of ideas here...

Community
  • 1
  • 1
  • 1
    My first tought is: maybe the `EndUri` and the `CallbackUrl` have to be the same. But it's just an idea. – Tóth Tibor Oct 30 '16 at 09:18
  • Tried that, doesn't help. BTW google works with different values. Ended up switching to MSAL. –  Oct 31 '16 at 10:43

0 Answers0