In my case issue was with nuget . I had System.IdentityModel.Tokens installed , so I switched to System.IdentityModel.Tokens.Jwt and this fixed an issue.