How to handle Entra ID account authentication without a Client ID and interactive Consent screen

고 현서 0 Reputation points

I am trying to login to the web with the email and password registered with Entra ID.

We are trying to process this action without consent in the custom login screen, but in order to create an OAuth2.0 token, we require a Client ID and even require consent if it is from another tenant.

Therefore, I would like to know how to check EntraID login information without additional screens such as consent.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,317 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
20,451 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. James Hamil 22,981 Reputation points Microsoft Employee

    Hi @고 현서 , you can use the Resource Owner Password Credentials (ROPC) flow. This flow allows you to exchange the user's email and password for an access token directly, without requiring an interactive consent screen or a client ID.

    However, please note that using the ROPC flow is not recommended in most scenarios, as it has several security and usability drawbacks. For example, it requires the user's password to be stored on the client side, which can be a security risk. Additionally, it does not support multi-factor authentication or conditional access policies.

    If you still want to use the ROPC flow, you can follow these steps:

    1. Register a new application in Azure AD and note down its Application ID.
    2. Grant the application the "User.Read" permission.
    3. In your custom login screen, prompt the user for their email and password.
    4. Use the following HTTP request to exchange the user's credentials for an access token:
    Content-Type: application/x-www-form-urlencoded

    Replace {tenant} with your Azure AD tenant ID, {application-id} with the Application ID of your registered application, {user-email} with the user's email address, and {user-password} with the user's password.

    1. Parse the response to extract the access token.

    Please note that the ROPC flow has several limitations and security risks, and should only be used as a last resort. It is recommended to use a more secure and flexible authentication flow, such as the Authorization Code flow or the Device Code flow, whenever possible.

    Please let me know if you have any questions and I can help you further.

    If this answer helps you please mark "Accept Answer" so other users can reference it.

    Thank you,