How to use Azure API connector to register an user through signin-signup user-flow from an ASP.NET Core Web API?

Nikhil Patil 21 Reputation points
2022-11-20T12:39:02.05+00:00

I want to execute the signup user-flow in Azureb2c from an ASP.NET Core Web API instead of executing it from our frontend app. To achieve this I found an approach of using API connector.

The documentation of API-Connector says

You can use API connectors to integrate your sign-up user flows with REST APIs to customize the sign-up experience and integrate with external systems

I assume with this explanation that I can execute a user-flow defined in AzureB2C for signin-signup from a Web API as a Http Request. What that is not clear is how the API connector actually work. When we still are in development phase and want to execute the API-Connector (and execute the user-flow via this), what type of http request we are supposed to send? Will it contain the Id/password we had defined when creating the API-Connector along with the user-details that needs to be passed to signup user-flow? What the URL which we had added when creating the API-Connector will be used for?

Unfortunately there is not much data available on API-Connector apart from the Azure official documentation, which I felt a bit confusing.

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,385 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,761 questions
{count} votes

Accepted answer
  1. Shweta Mathur 29,531 Reputation points Microsoft Employee
    2022-11-21T16:32:44.987+00:00

    Hi @Nikhil Patil ,

    Thanks for reaching out.

    API connector is the feature provided by B2C to enhance the Sign-Up experience of the user to integrate with REST API. Once API Connector is configured to use with specific user flow, whenever a user reaches the specific step, the API is invoked with user’s claim information as key-value pair in json body. API makes the required process and send the response to the B2C.

    It can only be used with below steps in B2C user flow where you can enable API connector:

    1. After sign-up with an identity provider
    2. Before creating the user
    3. Before sending the token

    So, during above steps in user flow, you can enable API connector to call REST API to integrate with external system i.e to validate user input, run some business logic.

    Unfortunately, it seems you are looking for other way round to call the user flow from your WebAPI through API connector as a http request which is not possible. The REST API service must be published to a publicly accessible HTTPS endpoint. The request to your REST API service comes from Azure AD B2C servers.

    In a user flow, you can protect your API endpoint by using either HTTP basic authentication or HTTPS client certificate authentication only.
    Reference links: https://learn.microsoft.com/en-us/azure/active-directory-b2c/api-connectors-overview?pivots=b2c-user-flow

    Hope this will help.

    Thanks,
    Shweta

    -------------------------------

    Please remember to "Accept Answer" if answer helped you.


0 additional answers

Sort by: Most helpful