I had the exact same problem. See my problem and solution here: ASP.NET Core 8 Web API : JWT token always invalid
TL;DR - Installing the package Microsoft.IdentityModel.JsonWebTokens solved the problem for me
Microsoft.IdentityModel.JsonWebTokens