Multiple logins required for Microsoft.Identity.Client and Azure.Identity

29254044 1 Reputation point
2022-10-05T12:36:57.203+00:00

Currently I am creating a application that uses both AzureIdentity (DefaultAzureCredential) and microsoft identity client (AcquireTokenInteractive) to identify the user in a .net winforms application. This requires 2 micrsoft logins and is not preferred. is it posible to use a token or another result of one of them so It can be decreased to 1 login.

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,649 questions
Microsoft Authenticator
Microsoft Authenticator
A Microsoft app for iOS and Android devices that enables authentication with two-factor verification, phone sign-in, and code generation.
6,150 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,629 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Shweta Mathur 29,756 Reputation points Microsoft Employee
    2022-10-07T06:00:43.767+00:00

    Hi @29254044 ,

    Thanks for reaching out.

    I understand you are trying to authenticate the users for your application using Azure.Identity and Microsoft.Identity.Client.

    Both Azure.Identity (DefaultAzureCredential) and Microsoft.Identity.Client(AcquireTokenInteractive) are different SDKs with common purpose which are used to authenticate the users to get the access token to access the API.

    Azure.Identity - is used to construct Azure SDK clients which support AAD token authentication using Managed Identity and Service Principal. It is available usually for all kinds of platforms and offers a variety of credential classes in the Azure.Identity namespace capable of acquiring an AAD token.

    Microsoft.Identity.Client - supports many different application architectures and platforms including .NET, JavaScript, Java, Python, Android, and iOS to acquire the token using different methods.
    MSAL.NET or Microsoft.Identity.Web are now the recommended auth libraries to use with the Microsoft identity platform.

    I am trying to understand what the case scenario requires you to get the same access token using two different ways. If you authenticate the same user using different SDKs , you will get the same access token. You can decode the tokens using jwt.ms.

    Hope this will help.

    Thanks,
    Shweta

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

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

    0 comments No comments