Azure Ad B2C: from client to server to another server?

Knippert 6 Reputation points
2022-06-02T11:18:00.553+00:00

I am trying to set up an application consisting of a front-end Next.js (client + server) application with a Asp.Net Core Web API. So there are two servers and one client.

Next.js has a nice library called nextAuth which allows using Azure Ad B2C as provider, see here: nextAuth Docs

I have been struggling for a few days to implement authorization as everything is still a bit new to me, so I have a lot of trouble distinguishing what I need and what are details for later.

I simply want to authenticate users on the front-end client and authorize the front-end server and the web api server endpoints.

What would a proper way to achieve this?

Do you need to implement Azure Ad B2C on both the front-end server and web api server?
Do you need to keep Azure Ad B2C to only the front-end server and then implement jwt tokens (with JWT AddAuthentication Asp.Net Core) from server to server?
Something else?

I would really appreciate any input!

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,140 questions
Microsoft Entra External ID
Microsoft Entra External ID
A modern identity solution for securing access to customer, citizen and partner-facing apps and services. It is the converged platform of Azure AD External Identities B2B and B2C. Replaces Azure Active Directory External Identities.
2,633 questions
{count} votes

1 answer

Sort by: Most helpful
  1. 2022-06-17T03:10:55.077+00:00

    Hello @Knippert , Next.js Azure Active Directory B2C provider looks great for the React client app. Besides that, you need to add authentication and authorization to your .NET Core API. Take a look to Enable authentication in your own web API by using Azure AD B2C for detailed steps.

    Let us know if this answer was helpful to you or if you need additional assistance. If it was helpful, please remember to accept it so that others in the community with similar questions can more easily find a solution.

    0 comments No comments