iTranslated by AI
Be Careful with IdentityModel.Tokens Namespace in .NET Core 2.x+ Authentication
TL;DR
When trying to implement authentication in .NET Core 2.x or higher,
classes under System.IdentityModel.Tokens as shown in MSDN do not exist.
They have moved to Microsoft.IdentityModel.Tokens, so use that instead.
When implementing based on online resources, be careful as the descriptions may assume .NET Core 1.x and the code might differ.
Background
While implementing JWT Authentication, I tried to use SigningCredentials and found it wasn't under System.IdentityModel.Tokens.
The following link is for .NET Framework 4.8, but even if you re-select .NET Core 2.2 from the menu, it redirects here:
SigningCredentials Class - MSDN
Upon investigation, I found the following Stack Overflow post.
Apparently, in .NET Core 2.x, System.IdentityModel.Tokens.Jwt ver 5.0.0 and later depends on
Microsoft.IdentityModel.Tokens instead of System.IdentityModel.Tokens.
Conflict between System.IdentityModel.Tokens and Microsoft.IdentityModel.Tokens - stackoverflow
Discussion