Forum Xamarin.Forms

Xamarin Auth with Microsoft Provider does not return a jwt token

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
                                    // Below values do not need changing
                                    new Uri(""),
                                    new Uri(""),// Set this property to the location the user will be redirected too after successfully authenticating
                                    new Uri("")
                    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
                          scope: "User.Read",
                          //authorizeUrl: new Uri(""),
                          //authorizeUrl: new Uri(""),

                          authorizeUrl: new Uri(""),
                          redirectUrl: new Uri("")
                          //redirectUrl: new Uri(" ")

                    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.


  • Oliv3rOliv3r USMember ✭✭

    Hi! Did you find any solution to this?


  • SreeSundaramSreeSundaram USMember ✭✭

    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?

Sign In or Register to comment.