Implementing Azure B2C using OpenIdConnect in .Net Core Web App(Model-View-Controller)

Implementing Azure B2C using OpenIdConnect in .Net Core Web App(Model-View-Controller)




What is Azure Active Directory B2C?

Azure Active Directory B2C provides business-to-customer identity as a service.

Customers can use their preferred social, enterprise, or local account identities to get single sign-on access to your applications and APIs. Azure AD B2C service is used for authorization such as access to API resources by authenticated users. Azure AD B2C is a white-label authentication solution which means it helps to customize the entire user experience with your brand so that it blends seamlessly with your web and mobile applications.


Steps to Implement Azure B2C Authentication

1)Create B2C Tenant

2)Register App

3)Create User Flows

4)Create Asp.Net Core Web App (Model-View-Controller)

Create Tenant




Give name, location of your Tenant and use subscription and resource group




Now Switch to created B2C Tenant


When Tenant is created it give detail about Domain name, subscription ID and Resource Group



Now next step is to register an app and define User Flows

App Registration



Define Name of your app and Redirect URL where Token will be send after successfully authentication



Check Access Token and ID token to received as response of authentication.




Now Create Different User Flows according to your requirements

User flows help quickly enable common identity tasks. User flow help user to interact with application like creating new account ,sign in ,Password reset or edit the profile


Name the user flow and add multifactor authentication through different medium if required



Define attribute that you want to take from user during signup process also claims attributes that you want to sent back as a response to application after sccessful authentication



Azure Tenant provide built in attribute, but we can also define our custom attribute according to requirement






You can also define lifetime of Access & ID Token after creating a user flow




User flow also facilitates to define captcha




You can also add custom HTML ,CSS Page by simply give URL of custom pages after customization


Define different User flows according to requirements




Final Step in to Create a .Net project and connect application to Azure forauthentication process using OpenIDConnect

By using following step it will authomatically define our appsettings and

program.cs file code we do not need to manually add values in appsettings

Sign in with your Azure Account and select your created B2C tenant and

registered App





.Net project will automatically install dependencies like OpenIdConnect

package and other dependencies

Appsettings.Json will contains Tenant ID, ClientID (app id) callback URL

where token as a response will e send and user flows URL


Run application and signup your new account

Azure B2C Tenant save registered users in User section. You can view or delete account of user



Sign in with your credential

After creating new account and successful login Azure B2C will return token

to callback url and display login user name



Claims From Tokens



You can also reset you password by simple click of reset password link


Profile edit




要查看或添加评论,请登录

Muhammad Arslan Khan的更多文章

  • PowerPages Azure AD B2C Authentication

    PowerPages Azure AD B2C Authentication

    Azure Active Directory (Azure AD) B2C is an OpenID Connect (OIDC) identity provider that allows external users to…

    4 条评论
  • Power Pages Multistep Form Metadata

    Power Pages Multistep Form Metadata

    In Power Pages (formerly known as Power Apps portals), Multistep Form Metadata enables advanced customization and…

  • DataFlow in Power Platform

    DataFlow in Power Platform

    DataFlows Dataflows are a self-service, cloud-based, data preparation technology. Dataflows enable customers to ingest,…

  • Service Account vs Service Principal

    Service Account vs Service Principal

    Power Automate allows to automate workflows. While creating a flow, we need to decide how to authenticate and authorize…

    5 条评论
  • Document Location

    Document Location

    What is Document Location Entity in Dynamics 365? Document Location Entity: In Dataverse, a Document Location is an…

  • How to configure Mail Box and Send Email Template using Power automate

    How to configure Mail Box and Send Email Template using Power automate

    Email Template allow to design email layout with runtime /dynamic values of record according to business…

  • Single Sign-On(SSO)

    Single Sign-On(SSO)

    When User login to mail it automatically login to others google services like Google Drive, Meet, YouTube How it’s…

    2 条评论

社区洞察

其他会员也浏览了