Add Microsoft login¶
You can add Microsoft login to your applications using Asgardeo and enable users to log in with their Microsoft accounts.
Follow this guide for instructions.
Register Asgardeo on Microsoft¶
You need to register Asgardeo as an OAuth2.0 application on Microsoft Entra ID.
Note
For detailed instructions, you can follow the Microsoft documentation.
-
Sign in to the Microsoft Entra admin center using an account with administrator permission.
Note
You must use an account in the same Microsoft 365 subscription (tenant) with which you intend to register the app.
-
Go to Identity > Applications > App registrations and select New registration.
-
Click Add and select App registration from the list.
-
Provide the required information for app registration.
Parameter Description Name Enter a meaningful name for your application. Supported Account Type Select the supported account type.
Value:Accounts in any organizational directory (Any Microsoft Entra ID tenant - Multitenant) and personal Microsoft accounts (e.g., Skype, Xbox)
Redirect URI Select Web as the platform and provide the URL to redirect after the login is completed.
Value:https://api.asgardeo.io/t/{organization_name}/commonauth
-
Click Register to create the application.
Note
Take note of the client ID after the application is created.
Now, let's generate a client secret for the application.
- Go to Certificates & secrets on the left navigation and click + New client secret.
- Enter a description for the client secret and select the expiry time.
-
Click Add to add the client secret.
Important
Take note of the generated Value. Microsoft Entra will allow copying this value only once. This value is the newly generated client secret for your Microsoft connection in Asgardeo.
Register the Microsoft IdP¶
Now, let's register the Microsoft IdP in Asgardeo.
- On the Asgardeo Console, go to Connections.
- Click New Connections and select Microsoft.
-
Enter the following details of the Microsoft identity provider and click Finish:
Parameter Description Name A unique name for this Microsoft identity provider. Client ID The client ID obtained from Microsoft. Client secret The client secret obtained from Microsoft. -
Go to the Settings tab and see the list of scopes to which Microsoft has granted permissions.
-
email: Allows to view the user's email address.
- openid: Allows authentication using OpenID Connect and to obtain the ID token.
- profile: Allows to view the user's basic profile data.
Note
Asgardeo needs these scopes to get user information. Asgardeo checks the attribute configurations of the application and sends the relevant attributes received from Microsoft to the app. You can read the Microsoft documentation to learn more.
Enable Microsoft login¶
Before you begin
You need to register an application with Asgardeo. You can register your own application or use one of the sample applications provided.
To enable Microsoft login:
- On the Asgardeo Console, go to Applications.
-
Select your application, go to the Login Flow tab and add Microsoft login from your preferred editor:
To add Microsoft login using the Classic Editor:
-
If you haven't already defined a sign-in flow, click Start with Default configuration to get started.
-
Click Add Authentication on the step, select your Microsoft identity provider, and click Add.
To add Microsoft login using the Visual Editor:
-
Switch to the Visual Editor tab, by default the
Username & Password
login flow will be added onto the Visual Editor's workspace. -
Click on
+ Add Sign In Option
to add a new authenticator to the same step and select your Microsoft connection.
Recommendations
It is recommended to add your social and enterprise connections to the first authentication step as they are used for identifying the user.
-
-
Click Update to save your changes.
Try it out¶
Follow the steps given below.
- Access the application URL.
- Click Login to open the Asgardeo login page.
-
On the Asgardeo login page, Sign in with Microsoft.
-
Log in to Microsoft with an existing user account.
Note
When a user successfully logs in with Microsoft for the first time, a user account is created in the Asgardeo Console with the Microsoft username. Microsoft will manage this new user account.
Configure connection¶
To learn more about other configurations available for the connection, refer to the add federated login documentation.