Authentication Identity server 4外部登录不在Firefox中工作,但在Chrome中工作

Authentication Identity server 4外部登录不在Firefox中工作,但在Chrome中工作,authentication,firefox,oauth,identityserver4,asp.net-core-3.1,Authentication,Firefox,Oauth,Identityserver4,Asp.net Core 3.1,我已经在ASP.NET core 3.1中使用Identity server 4实现了身份验证服务器。在这里,我使用Azure AD和Google作为外部登录提供商。这些外部登录提供程序在chrome浏览器中运行良好,但在Firefox中不起作用 身份验证码 services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme) .AddMicrosoftAccount(option =>

我已经在ASP.NET core 3.1中使用Identity server 4实现了身份验证服务器。在这里,我使用Azure AD和Google作为外部登录提供商。这些外部登录提供程序在chrome浏览器中运行良好,但在Firefox中不起作用

身份验证码

services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
    .AddMicrosoftAccount(option =>
    {
        option.SignInScheme = IdentityServerConstants.ExternalCookieAuthenticationScheme;
        option.ClientId = "Client id";
        option.ClientSecret = "Client secret";
        option.AuthorizationEndpoint = "AuthorizationEndpoint";
        option.TokenEndpoint = "TokenEndpoint";
        option.SaveTokens = true;
        option.StateDataFormat = new DistributedCacheStateDataFormatter(contextAccessor, "Microsoft");      
    })
    .AddGoogle(option =>
    {
        option.SignInScheme = IdentityServerConstants.ExternalCookieAuthenticationScheme;
        option.ClientId = "Client id";
        option.ClientSecret = "Client secret";
        option.SaveTokens = true;
    })
    .AddCookie(options =>
    {
        options.SlidingExpiration = true;
        options.ExpireTimeSpan = new TimeSpan(7, 0, 0, 0);
        options.Cookie.SameSite = SameSiteMode.Lax;
        options.Cookie.HttpOnly = true;
     });
使用chrome浏览器时,外部登录工作正常,身份验证正常。使用firefox浏览器时,从Azure AD获得以下异常:

System.Exception: An error was encountered while handling the remote login.
 ---> System.Exception: OAuth token endpoint failure: Status: BadRequest;Headers: Cache-Control: no-cache, no-store
Pragma: no-cache
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Content-Type-Options: nosniff
x-ms-request-id: 33040f25-8122-455c-b96a-f2cfd23acb00
x-ms-ests-server: 2.1.9926.12 - EST ProdSlices
P3P: CP="DSP CUR OTPi IND OTRi ONL FIN"
Set-Cookie: fpc=Atvp3Rwgaz5EtF1RBA6_Ip4XiiowBQAAAA7uwdUOAAAARMZjlAIAAAAO78HVDgAAAA; expires=Thu, 27-Feb-2020 08:59:59 GMT; path=/; secure; HttpOnly; SameSite=None, x-ms-gateway-slice=prod; path=/; SameSite=None; secure; HttpOnly, stsservicecookie=ests; path=/; secure; HttpOnly; SameSite=None
Date: Tue, 28 Jan 2020 08:59:59 GMT
;Body: {"error":"invalid_grant","error_description":"AADSTS54005: OAuth2 Authorization code was already redeemed, please retry with a new valid code or use an existing refresh token.\r\nTrace ID: 33040f25-8122-455c-b96a-f2cfd23acb00\r\nCorrelation ID: afb9b3fc-fb80-4796-b1e4-af31ec0261b1\r\nTimestamp: 2020-01-28 08:59:59Z","error_codes":[54005],"timestamp":"2020-01-28 08:59:59Z","trace_id":"33040f25-8122-455c-b96a-f2cfd23acb00","correlation_id":"afb9b3fc-fb80-4796-b1e4-af31ec0261b1"};
网络日志

注意:在Firefox和Chrome的localhost中,身份验证工作正常。仅发布后,Firefox不工作