admin管理员组文章数量:1386700
I am trying to login via an external provider on my Duende Asp.Net Identity Project. The project is hosted on Azure App Services. However when doing so, I get this error.
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
and its stuck on this url
https://{App service name}.azurewebsites/signin-microsoft?code={randomcode}
This only happens on Azure App Services and not on my local machine.
This is my authentication code.
builder.Services.AddAuthentication(options =>
{
options.DefaultScheme = IdentityConstants.ApplicationScheme;
options.DefaultSignInScheme = IdentityConstants.ExternalScheme;
})
.AddMicrosoftAccount(options =>
{
options.ClientId = aadConfig.ClientId;
options.ClientSecret = aadConfig.ClientSecret;
options.AuthorizationEndpoint = aadConfig.AuthorityEndpoint;
options.TokenEndpoint = aadConfig.TokenEndpoint;
})
.AddJwtBearer(options =>
{
options.Authority = addressConfig.AuthorityAddress;
options.TokenValidationParameters = new TokenValidationParameters
{
ValidateIssuer = true,
ValidIssuers = validIssuers,
ValidateAudience = false
};
})
.AddIdentityCookies(options =>
{
options.ApplicationCookie.PostConfigure(identityCookieOptions =>
{
identityCookieOptions.ExpireTimeSpan = TimeSpan.FromDays(30);
});
options.TwoFactorRememberMeCookie.PostConfigure(twoFactorCookieOptions =>
{
twoFactorCookieOptions.ExpireTimeSpan = TimeSpan.FromDays(30);
});
});
In the Azure App Registration, I have added the redirect URI for the web platform like the following
I have tried debugging the issue. It seems that it does go through the Account/PerformExternalLogin but it does not go through the ExternalLogin.razor page. It seems to me that after logging in, it does not redirect to the expected page.
I am trying to login via an external provider on my Duende Asp.Net Identity Project. The project is hosted on Azure App Services. However when doing so, I get this error.
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
and its stuck on this url
https://{App service name}.azurewebsites/signin-microsoft?code={randomcode}
This only happens on Azure App Services and not on my local machine.
This is my authentication code.
builder.Services.AddAuthentication(options =>
{
options.DefaultScheme = IdentityConstants.ApplicationScheme;
options.DefaultSignInScheme = IdentityConstants.ExternalScheme;
})
.AddMicrosoftAccount(options =>
{
options.ClientId = aadConfig.ClientId;
options.ClientSecret = aadConfig.ClientSecret;
options.AuthorizationEndpoint = aadConfig.AuthorityEndpoint;
options.TokenEndpoint = aadConfig.TokenEndpoint;
})
.AddJwtBearer(options =>
{
options.Authority = addressConfig.AuthorityAddress;
options.TokenValidationParameters = new TokenValidationParameters
{
ValidateIssuer = true,
ValidIssuers = validIssuers,
ValidateAudience = false
};
})
.AddIdentityCookies(options =>
{
options.ApplicationCookie.PostConfigure(identityCookieOptions =>
{
identityCookieOptions.ExpireTimeSpan = TimeSpan.FromDays(30);
});
options.TwoFactorRememberMeCookie.PostConfigure(twoFactorCookieOptions =>
{
twoFactorCookieOptions.ExpireTimeSpan = TimeSpan.FromDays(30);
});
});
In the Azure App Registration, I have added the redirect URI for the web platform like the following
https://memberportalidp20241224203416.azurewebsites/signin-microsoft
I have tried debugging the issue. It seems that it does go through the Account/PerformExternalLogin but it does not go through the ExternalLogin.razor page. It seems to me that after logging in, it does not redirect to the expected page.
Share Improve this question edited Mar 18 at 8:30 Jason 22.5k2 gold badges22 silver badges45 bronze badges asked Mar 18 at 6:19 Richard VoRichard Vo 11 bronze badge 5 |1 Answer
Reset to default 0I am able to resolve it, but not in a manner that I'm extremely satisfied with. I am curious to what changes to AddMicrosoftAccount would make it behave more similarly to the AddOpenIdConnect.
I've replaced the following
.AddMicrosoftAccount(options =>
{
options.ClientId = aadConfig.ClientId;
options.ClientSecret = aadConfig.ClientSecret;
options.AuthorizationEndpoint = aadConfig.AuthorityEndpoint;
options.TokenEndpoint = aadConfig.TokenEndpoint;
})
With this
AddOpenIdConnect("Microsoft", options =>
{
options.Authority = aadConfig.Authority;
options.ClientId = aadConfig.ClientId;
options.ClientSecret = aadConfig.ClientSecret;
options.ResponseType = OpenIdConnectResponseType.Code;
options.SaveTokens = true;
options.GetClaimsFromUserInfoEndpoint = true;
options.MapInboundClaims = false;
options.TokenValidationParameters.NameClaimType = JwtRegisteredClaimNames.Name;
})
Somehow, the AddOpenIdConnect doesn't have the same issues.
本文标签:
版权声明:本文标题:"The resource you are looking for has been removed, had its name changed, or is temporarily unavailable" with 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744522951a2610567.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
Application logs
inDiagnose and solve problems
? – Jason Commented Mar 18 at 7:58