How to Use Azure AD B2C As Identity Provider? #243
-
Hi, I am wondering how I would setup Azure AD B2C to use for authentication for accessing the backend. I know how to setup Azure AD by following the Quickstart, but I'm not sure what to put in for the issuer URL for the identity provider to make it work with Azure AD B2C. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
The issuer URL comes from Azure AD B2C. See https://stackoverflow.com/questions/66201234/where-can-i-obtain-my-azure-ad-b2c-issuer-url-in-the-portal (Proviso - I've not used AAD B2C in a looong time, but it's fairly standard. Grab an access token and use jwt.ms to decode it - the issuer is the "iss" field) |
Beta Was this translation helpful? Give feedback.
-
The way I have setup B2C in the ASP.NET Core API that is given to us by Adrian is below. I had done this before Adrian provided the code in the wiki. Anyway its working. `var builder = WebApplication.CreateBuilder(args); var connectionString = builder.Configuration.GetConnectionString("MS_TableConnectionString"); builder.Services.AddDbContext(options => options.UseSqlServer(connectionString)); // Adds Microsoft Identity platform (AAD v2.0) support to protect this Api builder.Services.AddDatasyncControllers(); var app = builder.Build(); // Initialize the database // Configure and run the web service. I have a delegating handler that enables jwt bearer token to provide the access token that comes back from azure B2C authentication service which I configure in the DatasyncClientOptions as per Adrians Wiki `var options = new DatasyncClientOptions
And here is the delegating handler `public class UserApiAuthenticationHandler : DelegatingHandler
Oh and the appsettings json
|
Beta Was this translation helpful? Give feedback.
The issuer URL comes from Azure AD B2C. See https://stackoverflow.com/questions/66201234/where-can-i-obtain-my-azure-ad-b2c-issuer-url-in-the-portal
(Proviso - I've not used AAD B2C in a looong time, but it's fairly standard. Grab an access token and use jwt.ms to decode it - the issuer is the "iss" field)