Could not load file or assembly 'IdentityModel,

So, I’m trying to get Okta work with MVC 5 (not the core version). I got it to work but when I log in I get the following error.

Could not load file or assembly ‘IdentityModel, Version=, Culture=neutral, PublicKeyToken=null’ or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference.

=== Pre-bind state information ===
LOG: DisplayName = IdentityModel, Version=, Culture=neutral, PublicKeyToken=null
LOG: Appbase = file:///C:/test/OktaTest/OktaTest/
LOG: Initial PrivatePath = C:\test\OktaTest\OktaTest\bin
Calling assembly : Okta.AspNet, Version=, Culture=neutral, PublicKeyToken=null.

LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\test\OktaTest\OktaTest\web.config
LOG: Using host configuration file: C:\Users\test\Documents\IISExpress\config\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).

LOG: Attempting download of new URL file:///C:/test/OktaTest/OktaTest/bin/IdentityModel.DLL.
WRN: Comparing the assembly name resulted in the mismatch: PUBLIC KEY TOKEN
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

Need help with this one.

Not a fix, but a useful work around is to downgrade your IdentityModel nuget package to 3.7.0. I had the same issue and this worked for me!

1 Like

That did the trick but seriously @OKTA a simple update to library shouldn’t be breaking things.