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...