Open Closed

MissingMethodException: Microsoft.IdentityModel.Tokens #9760


User avatar
0
MichelZ created

After updating to 9.3.1, when trying to log in using OpenID (Microsoft Azure), we get this exception:

2025-08-12T07:54:13|ERROR|authserver-69f45bbbbb-g444g |authserver-69f45bbbbb-g444g\app |10.51.2.244 | |T:34 |OpenIdConnectHandler      | |     || |Exception occurred while processing message.
EXCEPTION: System.MissingMethodException: Method not found: 'Void Microsoft.IdentityModel.Tokens.TokenValidationResult..ctor(Microsoft.IdentityModel.Tokens.SecurityToken, Microsoft.IdentityModel.Tokens.TokenHandler, Microsoft.IdentityModel.Tokens.TokenValidationParameters, System.String, System.Collections.Generic.List`1<Microsoft.IdentityModel.Tokens.Experimental.ValidatedToken>)'.
   at Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectHandler.ValidateTokenUsingHandlerAsync(String idToken, AuthenticationProperties properties, TokenValidationParameters validationParameters)
   at Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectHandler.HandleRemoteAuthenticateAsync()
2025-08-12T07:54:13|ERROR|authserver-69f45bbbbb-g444g |authserver-69f45bbbbb-g444g\app |10.51.2.244 | |T:34 |ExceptionHandlerMiddleware | |     || |An unhandled exception has occurred while executing the request.
EXCEPTION: Microsoft.AspNetCore.Authentication.AuthenticationFailureException: An error was encountered while handling the remote login.
 ---> System.MissingMethodException: Method not found: 'Void Microsoft.IdentityModel.Tokens.TokenValidationResult..ctor(Microsoft.IdentityModel.Tokens.SecurityToken, Microsoft.IdentityModel.Tokens.TokenHandler, Microsoft.IdentityModel.Tokens.TokenValidationParameters, System.String, System.Collections.Generic.List`1<Microsoft.IdentityModel.Tokens.Experimental.ValidatedToken>)'.
   at Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectHandler.ValidateTokenUsingHandlerAsync(String idToken, AuthenticationProperties properties, TokenValidationParameters validationParameters)
   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 Volo.Abp.AspNetCore.Security.AbpSecurityHeadersMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.&lt;&gt;c__DisplayClass2_0.&lt;&lt;CreateMiddleware&gt;b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Volo.Abp.AspNetCore.Tracing.AbpCorrelationIdMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.&lt;&gt;c__DisplayClass2_0.&lt;&lt;CreateMiddleware&gt;b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.&lt;Invoke&gt;g__Awaited|10_0(ExceptionHandlerMiddlewareImpl middleware, HttpContext context, Task task)

Microsoft Packages are all updated, Microsoft.IdentityModel.Tokens resolved Version seems to be 8.12.1 The release notes for this Version do say they had a little accident with leaking experimental code: https://github.com/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet/releases/tag/8.12.1 (PR https://github.com/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet/pull/3259 for remediation)

I don't know if this is something in ABP to solve or upstream, but external login for us does not work in 9.3.1.

└─ Volo.Abp.AspNetCore.MultiTenancy (v9.3.1)
   │     └─ Volo.Abp.AspNetCore (v9.3.1)
   │        └─ Microsoft.AspNetCore.Authentication.OpenIdConnect (v9.0.8)
   │           └─ Microsoft.IdentityModel.Protocols.OpenIdConnect (v8.12.0)
   │              ├─ Microsoft.IdentityModel.Protocols (v8.12.0)
   │              │  └─ Microsoft.IdentityModel.Tokens (v8.12.1)
   │              └─ System.IdentityModel.Tokens.Jwt (v8.12.0)
   │                 ├─ Microsoft.IdentityModel.JsonWebTokens (v8.12.0)
   │                 │  └─ Microsoft.IdentityModel.Tokens (v8.12.1)
   │                 └─ Microsoft.IdentityModel.Tokens (v8.12.1)

11 Answer(s)
  • User Avatar
    0
    AI-Bot created
    Support Team ABP Agent

    The exception you are encountering is due to a breaking change in the Microsoft.IdentityModel.Tokens package version 8.12.1, where experimental code was accidentally released and then removed in a subsequent patch. This causes a MissingMethodException when libraries (such as Microsoft.AspNetCore.Authentication.OpenIdConnect) expect the removed constructor.

    To resolve this issue:

    1. Downgrade Microsoft.IdentityModel.Tokens
      Change your project's dependency to use Microsoft.IdentityModel.Tokens version 8.11.x (or any version before 8.12.1). This will restore the missing method and resolve the exception.

      In your .csproj or via your package manager:

    <PackageReference Include="Microsoft.IdentityModel.Tokens" Version="8.11.2" />
    
    1. Clear NuGet Cache and Rebuild
      After downgrading, clear your NuGet cache and perform a clean rebuild to ensure the correct version is used throughout your solution.

    2. Monitor Upstream Fixes
      The issue is upstream and tracked by Microsoft. You can follow the official remediation and future releases here:

    3. Wait for ABP/Upstream Updates
      Once Microsoft and/or ABP update their dependencies to a fixed version, you can safely upgrade again.

    This is not an ABP-specific bug, but a result of a breaking change in a Microsoft dependency.

    Sources:

    • https://github.com/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet/releases/tag/8.12.1
    • https://github.com/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet/pull/3259

    This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.

  • User Avatar
    0
    MichelZ created

    Thanks AI Bot. I know how I can potentially resolve this, but it's probably something that should be handled in-product, but I'm not sure if it needs handling directly or via another dependent library.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Does the MissingMethodException only happen in Azure?

    Can you get the same exception in your local?

    Thanks.

  • User Avatar
    0
    MichelZ created

    [maliming] said: hi

    Does the MissingMethodException only happen in Azure?

    Can you get the same exception in your local?

    Thanks.

    We are not running in Azure. This runs in Kubernetes as a Container. If you're asking if it works while logging in locally (Username/Password Authentication) - then yes, that works

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Does it work when signing in using OpenID on your local?

  • User Avatar
    0
    MichelZ created

    We do not have external login setup for local currently

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Can you resolve the problem by adding these packages with an explicit 8.12.0 version?

    If so, It might be that the dependencies in your project are not consistent. Adding explicit packages is the solution.

    Run dotnet package list --include-prerelease and share output.

    <PackageReference Include="Microsoft.IdentityModel.Protocols.OpenIdConnect" Version="8.12.0" />
    <PackageReference Include="Microsoft.IdentityModel.Tokens" Version="8.12.0" />
    <PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="8.12.0" />
    

    Thanks

  • User Avatar
    0
    MichelZ created

    I have now traced where the 8.12.1 version comes from. Owl.TokenWildcardIssuerValidator 2.0 :) :)

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    ok, you can use explicit package in your solution. Abp framework will update them to latest.

    Thanks.

  • User Avatar
    0
    MichelZ created

    Yes, downgrading the package works

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    👍

Learn More, Pay Less
33% OFF
All Trainings!
Get Your Deal
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.0.0-preview. Updated on September 12, 2025, 10:20