Azure AD B2C JWT Authentication
See original GitHub issueHas anyone got a good example of how to get Carter to accept a JWT from Azure AD B2C?
This is what I have so far and it is failing.
app.UseCarter(GetOptions(new[] { Configuration["oa:basepath"] }));
private CarterOptions GetOptions(ICollection<string> addresses)
{
var options = new OpenApiOptions(
"Test API",
addresses,
new Dictionary<string, OpenApiSecurity>
{
{
"BearerAuth",
new OpenApiSecurity
{
Type = OpenApiSecurityType.http,
Scheme = "bearer",
BearerFormat = "JWT",
Name = "Authorization",
In = OpenApiIn.header
}
}
}, new[] { "BearerAuth" });
return new CarterOptions(null, null, options);
}
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
Overview of tokens - Azure Active Directory B2C
A JWT contains three segments, a header, a body, and a signature. The signature segment can be used to validate the authenticity of...
Read more >Securing Your Web API with Azure AD B2C JWT Validation ...
Hi Everyone, In this video, we will see How to configure the Azure AD B2C JWT Validation Policy in API management to protect...
Read more >Azure Active Directory B2C Token Generation With No ...
Learn how to configure Azure Active Directory B2C, so you can request an Authentication Token without any user interaction.
Read more >Getting an access token in Azure AD B2C
Now when I log in, I get two tokens; an access token and an ID token. The access token looks like this: Image...
Read more >Azure AD B2C Preview: Token Reference
A JWT is a compact, URL-safe means of transferring information between two parties. The information contained in JWTs are known as "claims", or...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That code has nothing to do with authentication it’s just setting up metadata for the openapi generated docs.
You’ll need something like
services.AddAuthentication.AddAzureFoo()
for it to work with JWTFor those who might come here in the future, here is how I got it working…
Also
app.UseAuthentication();
I also opted for second option in this drop-down, which made a difference.
It took me less than a day to sort out. I hope it takes you less 😃