We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.

Christian • 3 years ago

For anyone who comes here and it still does not work for my solution I had to add some options to AddAuthentication

services.AddAuthentication(options =>
{
options.DefaultAuthenticateScheme = TestAuthHandler.AuthenticationScheme;
options.DefaultScheme = TestAuthHandler.AuthenticationScheme;
options.DefaultChallengeScheme = TestAuthHandler.AuthenticationScheme;
})
.AddScheme<testauthhandleroptions, testauthhandler="">(
TestAuthHandler.AuthenticationScheme, options => {});

Especially the DefaultChallengeScheme (which I mistakenly initialy did not set).
----
Also, I myself didn't use ClaimTypes.Role when adding a role in the HandleAUthenticateAsync (not depicted in this tutorial) which gave me a big headache.

Dominique St-Amand • 4 years ago

Great post!
Since a lot of people are using JWT's to secure their APIs, I'm maintaining a JWT faker library available here:

https://github.com/webmotio...

It allows people to mock a JWT with their business logic and test that their auth'n/auth'z pipeline work properly.

Muhammad Azeez • 4 years ago

I hadn't seen your library. I love it!

Arslan • 3 years ago

I used WebMotions.Fake.Authentication.JwtBearer Nuget. It works on my machine but not working on aws lambda. Any idea what's going on?
I get this error:
Amazon.SecretsManager.AmazonSecretsManagerException : The security token included in the request is invalid.