AADSTS50011: The reply url specified in the request does not match the reply urls configured for the application: ''

前端 未结 8 1709
我寻月下人不归
我寻月下人不归 2021-02-18 13:12

I have a .NET Core 2 app template that is configured to use Azure AD out of the box.

The configuration is:

{
  \"AzureAd\": {
    \"Instance\": \"https:         


        
8条回答
  •  -上瘾入骨i
    2021-02-18 13:46

    Make sure services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); must below the Authentication configuration.

    services.AddAuthentication(options =>
    {
        options.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
        options.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
        options.DefaultAuthenticateScheme = CookieAuthenticationDefaults.AuthenticationScheme;
    })
    .AddOpenIdConnect(options =>
    {
        options.Authority = "";
        options.ClientId = "";
        options.ResponseType = OpenIdConnectResponseType.IdToken;
        options.CallbackPath = "";
        options.SignedOutRedirectUri = "";
        options.TokenValidationParameters.NameClaimType = "name";
    })
    .AddCookie();
    

    I was facing the same error due to having added AddMvc() before the AddAuthentication() extension method.

提交回复
热议问题