Search code examples
authenticationentity-framework-coreasp.net-core-mvcopenid-connectopeniddict

OpenIdConnectProtocolException: Message contains error: 'invalid_grant', error_description: 'The specified authorization code is no longer valid.'


I'm having this error while login, what may be wrong?

Need to note, I've applied few minor updates to some packages on the both sides - server and client (and before that all worked fine):

  1. "Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.2" --> 6.0.3
  2. "Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="6.0.2" --> 6.0.3
  3. "Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.1" --> 6.0.3
  4. "Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.2" --> 6.0.3
  5. And so on for EF Core, Microsoft.Extensions, etc

Stack trace:

System.Exception: An error was encountered while handling the remote login. ---> Microsoft.IdentityModel.Protocols.OpenIdConnect.OpenIdConnectProtocolException: Message contains error: 'invalid_grant', error_description: 'The specified authorization code is no longer valid.', error_uri: 'https://documentation.openiddict.com/errors/ID2016'. at Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectHandler.RedeemAuthorizationCodeAsync(OpenIdConnectMessage tokenEndpointRequest) at Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectHandler.HandleRemoteAuthenticateAsync()

--- End of inner exception stack trace ---

at Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler`1.HandleRequestAsync() at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)


Auth Server logs:

info: Microsoft.Hosting.Lifetime[14]
      Now listening on: https://localhost:5003
info: Microsoft.Hosting.Lifetime[14]
      Now listening on: http://localhost:5004
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
      Content root path: C:\AuthServer
info: OpenIddict.Server.OpenIddictServerDispatcher[0]
      The request address matched a server endpoint: Configuration.
info: OpenIddict.Server.OpenIddictServerDispatcher[0]
      The configuration request was successfully extracted: {}.
info: OpenIddict.Server.OpenIddictServerDispatcher[0]
      The configuration request was successfully validated.
info: OpenIddict.Server.OpenIddictServerDispatcher[0]
      The response was successfully returned as a JSON document: {
        "issuer": "http://localhost:5004/",
        "authorization_endpoint": "http://localhost:5004/connect/authorize",
        "token_endpoint": "http://localhost:5004/connect/token",
        "introspection_endpoint": "http://localhost:5004/introspect",
        "end_session_endpoint": "http://localhost:5004/connect/logout",
        "userinfo_endpoint": "http://localhost:5004/connect/userinfo",
        "jwks_uri": "http://localhost:5004/.well-known/jwks",
        "grant_types_supported": [
          "client_credentials",
          "authorization_code",
          "refresh_token"
        ],
        "response_types_supported": [
          "code"
        ],
        "response_modes_supported": [
          "form_post",
          "fragment",
          "query"
        ],
        "scopes_supported": [
          "openid",
          "offline_access",
          "api",
          "profile"
        ],
        "claims_supported": [
          "aud",
          "exp",
          "iat",
          "iss",
          "sub"
        ],
        "id_token_signing_alg_values_supported": [
          "RS256"
        ],
        "code_challenge_methods_supported": [
          "S256"
        ],
        "subject_types_supported": [
          "public"
        ],
        "token_endpoint_auth_methods_supported": [
          "client_secret_basic",
          "client_secret_post"
        ],
        "introspection_endpoint_auth_methods_supported": [
          "client_secret_basic",
          "client_secret_post"
        ],
        "claims_parameter_supported": false,
        "request_parameter_supported": false,
        "request_uri_parameter_supported": false
      }.
info: OpenIddict.Server.OpenIddictServerDispatcher[0]
      The request address matched a server endpoint: Cryptography.
info: OpenIddict.Server.OpenIddictServerDispatcher[0]
      The cryptography request was successfully extracted: {}.
info: OpenIddict.Server.OpenIddictServerDispatcher[0]
      The cryptography request was successfully validated.
info: OpenIddict.Server.OpenIddictServerDispatcher[0]
      The response was successfully returned as a JSON document: {
        "keys": [
          {
            "kid": "S_BMQOKNGJHJPWXBJUIHMDYJ4KBGJVSP13T2OAZJ",
            "use": "sig",
            "kty": "RSA",
            "alg": "RS256",
            "e": "AQAB",
            "n": "s_bmqoKNgJhJpWxbjUIhmDyj4KBgjvSP13t2OAZJv8FLVNHgkFMk8XpDetuR4EWnCOH-CfA4_QG_B-75a3ivA6eIQlHj9B1-ALe8ixxhGc_0BhaeHnRmR02P9XZPl3KfmK6zyjFUwQ84b4VHLMpAQt9lGSCmC0RWckk3ABVWKTfqNenHZyRywVfQx
MlJOrCkjVhbkXylN1NZogNsHzR1R86wCxF-6ZQAizItXnSXS0vqbeUDKK5ypvCGTixttBupes7Gl6FCc43XOjLI1yyNi4Oclla8vpAcRFT7qIlNXiAe87Cx1P2SUiCXqa28IuK5kE6GJXJ7oCuXUNT-ObJTEQ"
          }
        ]
      }.
info: OpenIddict.Server.OpenIddictServerDispatcher[0]
      The request address matched a server endpoint: Authorization.
info: OpenIddict.Server.OpenIddictServerDispatcher[0]
      The authorization request was successfully extracted: {
        "client_id": "dotnet",
        "redirect_uri": "http://localhost:5883/signin-oidc",
        "response_type": "code",
        "scope": "openid profile api offline_access",
        "code_challenge": "Z7awdswUZx0ETP0dpUffZ1YBvEkbHq36oyqinMHNXhM",
        "code_challenge_method": "S256",
        "response_mode": "form_post",
        "nonce": "637849932918438810.NjI1NmFkOWMtYTljYi00NDEzLWJiMDktNmY2ZTUxM2QzMzIwZGFkYjNiNDUtMDliYi00ZDVlLTk3OGUtODQ5NzlhMWRkZmJh",
        "state": "CfDJ8HK7TnNlqEtJvZnagmcXTEBxqCNdO9qAvzNhBZSsvnUV4ngLvlZ0Ft0LF2hpjjQRCB4mbP0K2_Se4z9YK_UMKuICGCwZZK3VbWxDSVemxpWMP63dNPhscDFCFFpQUbRh4bAsP5vhZMnR7K4Hg2FlUXroqwsfQTDo9KFepmZg3qlqJ8cODBDPf
v_CaY2f4QCFw-eLtGKrH1SIs4KvAcvss7OvQmqt-40OA9eU3fFG94kH50df6s48omgNb72V5hAQs6UWdBnj6DHRwnrt51a_M3NwEiOyj5dXAH6VE5Ebxd8PxHhvCkUf-9_tYTKTmbJfXiyEoNVEPLkrjtyPBTxiPxu92jm0bgqfchMSWrqAnRrQ7PzQPfxBFTJpTUMyQkHY
-w",
        "x-client-SKU": "ID_NETSTANDARD2_0",
        "x-client-ver": "6.10.0.0"
      }.
info: OpenIddict.Server.OpenIddictServerDispatcher[0]
      The authorization request was successfully validated.
info: OpenIddict.Server.OpenIddictServerDispatcher[0]
      The request address matched a server endpoint: Authorization.
info: OpenIddict.Server.OpenIddictServerDispatcher[0]
      The authorization request was successfully extracted: {
        "client_id": "FMS-dotnet",
        "redirect_uri": "http://localhost:58893/signin-oidc",
        "response_type": "code",
        "scope": "openid profile api offline_access",
        "code_challenge": "Z7awdswUZx0ETP0dpUffZ1YBvEkbHq36oyqinMHNXhM",
        "code_challenge_method": "S256",
        "response_mode": "form_post",
        "nonce": "637849932918438810.NjI1NmFkOWMtYTljYi00NDEzLWJiMDktNmY2ZTUxM2QzMzIwZGFkYjNiNDUtMDliYi00ZDVlLTk3OGUtODQ5NzlhMWRkZmJh",
        "state": "CfDJ8HK7TnNlqEtJvZnagmcXTEBxqCNdO9qAvzNhBZSsvnUV4ngLvlZ0Ft0LF2hpjjQRCB4mbP0K2_Se4z9YK_UMKuICGCwZZK3VbWxDSVemxpWMP63dNPhscDFCFFpQUbRh4bAsP5vhZMnR7K4Hg2FlUXroqwsfQTDo9KFepmZg3qlqJ8cODBDPf
v_CaY2f4QCFw-eLtGKrH1SIs4KvAcvss7OvQmqt-40OA9eU3fFG94kH50df6s48omgNb72V5hAQs6UWdBnj6DHRwnrt51a_M3NwEiOyj5dXAH6VE5Ebxd8PxHhvCkUf-9_tYTKTmbJfXiyEoNVEPLkrjtyPBTxiPxu92jm0bgqfchMSWrqAnRrQ7PzQPfxBFTJpTUMyQkHY
-w",
        "x-client-SKU": "ID_NETSTANDARD2_0",
        "x-client-ver": "6.10.0.0"
      }.
info: OpenIddict.Server.OpenIddictServerDispatcher[0]
      The authorization request was successfully validated.
info: OpenIddict.Server.OpenIddictServerDispatcher[0]
      The authorization response was successfully returned to 'http://localhost:58893/signin-oidc' using the form post response mode: {
        "code": "[redacted]",
        "state": "CfDJ8HK7TnNlqEtJvZnagmcXTEBxqCNdO9qAvzNhBZSsvnUV4ngLvlZ0Ft0LF2hpjjQRCB4mbP0K2_Se4z9YK_UMKuICGCwZZK3VbWxDSVemxpWMP63dNPhscDFCFFpQUbRh4bAsP5vhZMnR7K4Hg2FlUXroqwsfQTDo9KFepmZg3qlqJ8cODBDPf
v_CaY2f4QCFw-eLtGKrH1SIs4KvAcvss7OvQmqt-40OA9eU3fFG94kH50df6s48omgNb72V5hAQs6UWdBnj6DHRwnrt51a_M3NwEiOyj5dXAH6VE5Ebxd8PxHhvCkUf-9_tYTKTmbJfXiyEoNVEPLkrjtyPBTxiPxu92jm0bgqfchMSWrqAnRrQ7PzQPfxBFTJpTUMyQkHY
-w"
      }.
info: OpenIddict.Server.OpenIddictServerDispatcher[0]
      The request address matched a server endpoint: Token.
info: OpenIddict.Server.OpenIddictServerDispatcher[0]
      The token request was successfully extracted: {
        "client_id": "dotnet",
        "client_secret": "[redacted]",
        "code": "[redacted]",
        "grant_type": "authorization_code",
        "redirect_uri": "http://localhost:5883/signin-oidc",
        "code_verifier": "ZSc9m368w1L5nAa45BKzC3u_KWfpjL_AuObTZY0l5H8"
      }.
info: OpenIddict.Server.OpenIddictServerDispatcher[0]
      The response was successfully returned as a JSON document: {
        "error": "invalid_grant",
        "error_description": "The specified authorization code is no longer valid.",
        "error_uri": "https://documentation.openiddict.com/errors/ID2016"
      }.

Request

POST /signin-oidc HTTP/1.1
Host: localhost:5883
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:99.0) Gecko/20100101 Firefox/99.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate, br
Content-Type: application/x-www-form-urlencoded
Content-Length: 445
Origin: http://localhost:5004
Connection: keep-alive
Referer: http://localhost:5004/
Cookie: .AspNetCore.OpenIdConnect.Nonce.CfDJ8HK7TnNlqEtJvZnagmcXTEC3cHpDF4OwF62WoM3Pu_IhY0BaWGPNZG8QuvCluke05nuuveAqWgrnJXltpWh950e27BF-d8kxhmEpC4cTUqKFK5ObjhVAFevKu-jHky98HWvZS6O6TV3rQM6fr0TYOh4-kNRHsODtgIRGAxuXkLvXPCA1q6bX9ryXy5huIsIUk705dWQK3f00yEMv0jpjv4aGqItksQp76OVuP3w3nasA4IJSQrYzrXKgSmi67MSABH_Ljjig1Vnxvv-TTqKmKgo=N; .AspNetCore.Correlation.Hfb7_cXI-2YLxhGXNJH44sYzNI4IpwrWy04YE5DiIDo=N; .AspNetCore.Antiforgery.PQveA42vVM8=CfDJ8HK7TnNlqEtJvZnagmcXTEAStwwI3n3s4RhrKnI85QiBaolcDshCOd8naHsLjFea04KmjAFofLehorYD3uRtBUK0wZ8ZGI3WtWZN5zKdrr5qSn2v87WWWVKQeqeE5jLANuyeIs9Dxhhy1dt0HUrb7_U; .AspNetCore.Identity.Application=CfDJ8HK7TnNlqEtJvZnagmcXTEBDcO_BcayxBKlUevk270H1lDcXKUZoVF2EqKpcWVPeYuEgGtqs_bYyL2aMpA4l5aY8JZ2nHNT4K8mXZKXrN0imVFq9LcUQ7W8n9qqZzOemR6aWeIohk4gzsM6JAnrIBBSjXjrpVPC7O3vPOyf3xZeJ8ZPuo_ksrzJpZwJN_H5YXEryz2XlROryVpy7xSi9va780_pX5A-J6G_NF8lG_dM-3iiyDkdhpN3wSIephQB5aFDma4XdUNcLdpJGxfp_LPyiy2oxJoevp9M4fEpm7E1FwQwlTr4CUkHieD22fhLSwRqzmu7d9w0g0cPxas-1t4bNC8NCugSIj0OrYnUUS8aEZXM9wJfjYIDUpW_b5k4BIvShZ6uL2Q2PezaUVngvxOwPRgCECtCDOYSmMnOtZCuF_Y55pM1nkLspRvOBXXnnnfoWTm9_lcbPAvh6AxecJ0teBLrLOkUiYPS3bkYUm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opiGXuybx4d362AJytYi7NLoJdeOCNwkx5yfoAxXYr1yTmkFausY7Su2aD6pZXt1b8vUG_0s2JaqMHaWH6-68h2u-MmX_PNsc8NgbhBih-gyFr96oKAXlC3t5aIr8AvHV2OeyNTCIfkOsWdcUXbJb2rGbTRdytfpPqbMXERiuY8YHVO4ltQhFLVNxb3AzGbx2LFp2y5QRIsBJzGDcGIzfx0moTYV8KQUJmWB-gowFA6vm-rGTHcVhsmoCxDApzrSA; Identity.External=CfDJ8HK7TnNlqEtJvZnagmcXTECsSZDKEJmljUVD--xDPxD8Dn1rWkiTflCXSd91IlKyfcx0_JBBBRSRJuwxEBbcu6IxBycqtPPcJGeHrxlZAou71JKsru5sAagb1N-KrbnkMKkrMH83oRnaPv-NBywT2ONAfoC4WepLH7-AgdTT_8VU2ifNPxbwcA5lovRywrMj3WjcWINW0KwJE7nU1nB4Nw2tWdlnJ47_G5tfZBi1tchSFQu0OtkUdZLramYY7RTsDvNanSqAAgh3HpU0w2-eWJMzs6xjEipJK_azdHkqmOmRqHA3aYaWL6uGkUGBEQtAn7ohuwNpIb1DDSNJ8zAvIIjBGpW9BvJLDa_GKP0qe6Nm-aXEtIxElhW-l0ucWXkBNS80ZXMLDaPF4wjtLbXA5VymGYB5z5aQwmq4pNQe53PkXslQY8YgUW1Y6QbfAW2HazZY3snjhAHybh9JMPwTfV8
Upgrade-Insecure-Requests: 1
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: same-site

Form data

{
    "code": "YPWe2LyqczH3B-5hySGyyvi0Ezfrc4BeIAbHABrFtH4",
    "state": "CfDJ8HK7TnNlqEtJvZnagmcXTEChyH5IIo-LXPg5s1jbtbDLg2WuabxHdPfenYYSF_1auYU3eaGZtIHqSS0tNbPHTj0OQHUvslE6ZsMts0b4RIqOk-e7vdMkP6d-tszHRW6g7ZCFfhsYVK7qCDGjKBFAmSDjJAlGHxHHr265TYiZcRY3jyhbLWBKWwmNCLXjXVlgdlIQyQlCWtY-yd9zoCEgiigdJ-suh0WJJHMqJmu20rLf3Es75aIf9EWh6Ki-0aTd6VJVamkmv6DrcPgOyOdyiplVKNVkqj8rj-qmK8RoRH0i80Qd7g03llVnoWzujKDXfUAXunGjKPAIqwSZm5MULtR1wzzxu_8fAPmKRmEnH3Su7RPWIEhBauSCLihPLA6GtQ"
}   

Solution

  • Thanks to Jeremy's great find, I finally realized what is the cause of the problem. So, it could be fixed in one line to ctor of OpenIddict DbContext:
    AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);

    https://www.npgsql.org/efcore/release-notes/6.0.html#opting-out-of-the-new-timestamp-mapping-logic