The following code works well for Google and it returns a jwt token. But when I try for Microsoft, I get a token but it is not a jwt token. It returns an authorization code (I think)..Is this a bug or by design? I need to pass the jwt token received from the provider to my backend Azure Mobile App for authentication.
Any help or assistance is appreciated.
The google call below gives me a well formed jwt token AAAA.BBBBB.CCCCCC
var auth = new OAuth2Authenticator( // For Google login, for configure refer http://www.c-sharpcorner.com/article/register-identity-provider-for-new-oauth-application/ "xxxxx.apps.googleusercontent.com", "xxxx", // Below values do not need changing "https://www.googleapis.com/auth/userinfo.email", new Uri("https://accounts.google.com/o/oauth2/auth"), new Uri("https://xxx.azurewebsites.net/.auth/login/google/callback"),// Set this property to the location the user will be redirected too after successfully authenticating new Uri("https://accounts.google.com/o/oauth2/token") ); Type pageType = auth.GetUI(); _frame.Navigate(pageType, auth);
The Microsoft call below gives me a code XXXXXXXX and not a well formed jwt token
var auth = new OAuth2Authenticator( clientId: "xxxxx", // For Micrsoft login, for configure refer http://www.c-sharpcorner.com/article/register-identity-provider-for-new-oauth-application/ scope: "User.Read", //authorizeUrl: new Uri("https://login.microsoftonline.com/common/oauth2/V2.0/authorize"), //authorizeUrl: new Uri("https://login.live.com/oauth20_authorize.srf"), authorizeUrl: new Uri("https://login.live.com/oauth20_authorize.srf?client_id=fde79d5e-0560-48ea-8b5d-791ef210f2dd&scope=wl.basic&response_type=token&redirect_uri=https://valufy.azurewebsites.net/.auth/login/microsoftaccount/callback"), redirectUrl: new Uri("https://valufy.azurewebsites.net/.auth/login/microsoftaccount/callback") //redirectUrl: new Uri("https://login.live.com/oauth20_desktop.srf ") ); Type pageType = auth.GetUI(); _frame.Navigate(pageType, auth);
When the auth is completed, I get a JWT token from google and a code from Microsoft.
Answers
Hi! Did you find any solution to this?
/Oliver
I gave up on this path and switched to Azure AD B2C. Was never able to get any answer from the Xamarin.Auth folks. Azure AD B2C works well for Microsoft, Google and Twitter so far.
Hi ,
I am trying Azure AD B2C. I am using MS.Identity.Client 4.2.1. Its Authenticated but the results are not pushed back. Its stayed in the Webview after Login. Any ideas on this?