Error: "Microsoft account is experiencing technical problems. Please try again later." while using Microsoft Authentication API


  • We are working on a project in which we are trying to use Microsoft live authentication.  We are using MVC Web Application using C#.

    Our code works from the development machine. The settings are proper and when we click the button "Sign in with Microsoft". it is redirected to the microsoft signin page.

    But when we deployed this code on the production server, it is not working. When we checked the error in detail, it seems that the redirect URI is not matching with the one that we have set in the Microsoft account.

    Now the redirect URI that we have set is proper and has https. But the microsoft authentication code sends the redirect URL with the scheme "http" instead of "https". We have double checked the client id and secret settings and it does take the live account settings. Not sure why it is not picking up the correct url scheme.

    our live site url is

    Following is our setup for Microsoft Authentication in Startup.Auth.cs

    public void ConfigureAuth(IAppBuilder app)
                app.UseCookieAuthentication(new CookieAuthenticationOptions
                      AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
                      LoginPath = new PathString("/Account/Login"),
                app.UseTwoFactorSignInCookie(DefaultAuthenticationTypes.TwoFactorCookie, TimeSpan.FromMinutes(5));
                MicrosoftAccountAuthenticationOptions mo = new MicrosoftAccountAuthenticationOptions()
                    ClientId = WebConfigurationManager.AppSettings["MicrosoftclientId"],
                    ClientSecret = WebConfigurationManager.AppSettings["MicrosoftclientSecret"],
                mo.SignInAsAuthenticationType = DefaultAuthenticationTypes.ExternalCookie;
                mo.Provider = new Microsoft.Owin.Security.MicrosoftAccount.
                    OnAuthenticated = async context =>
                        context.Identity.AddClaim(new System.Security.Claims.Claim
                        ("urn:microsoftaccount:access_token", context.AccessToken));
                        foreach (var claim in context.User)
                            var claimType = string.Format("urn:microsoftaccount:{0}", claim.Key);
                            string claimValue = claim.Value.ToString();
                            if (!context.Identity.HasClaim(claimType, claimValue))
                                context.Identity.AddClaim(new System.Security.Claims.Claim
                                (claimType, claimValue, "XmlSchemaString", "Microsoft"));

    25 Mei 2018 8:18

Semua Balasan