Auth0 Home Blog Docs

How to get custom attributes when signin with Azure AD B2C

api

#1

Hi all,
I use .NET framework to working with Auth0 and Azure AD B2C. But I don’t know how to get all attributes of a user on Azure AD.
var profile = await client.GetUserInfoAsync(token.AccessToken);
The current API just get simple attributes.
Please help me clarify it.
Thanks so much.


#2

:wave: @hiepbui what kind of attributes are you looking to get? And which API are you referring to, is it the Azure AD Graph API?


#4

I am using Azure AD B2C, created some custom attributes. Then I created an Enterprise Connection on Auth0 that use for login on my application. I working on .Net framework. But I don’t know way to get that attributes or get all attribute.
AuthenticationApiClient client = new AuthenticationApiClient(
new Uri(string.Format(“https://{0}”, ConfigurationManager.AppSettings[“auth0:Domain”])));

            var token = await client.GetTokenAsync(new AuthorizationCodeTokenRequest
            {
                ClientId = ConfigurationManager.AppSettings["auth0:ClientId"],
                ClientSecret = ConfigurationManager.AppSettings["auth0:ClientSecret"],
                Code = context.Request.QueryString["code"],
                RedirectUri = context.Request.Url.ToString()
            });

            var profile = await client.GetUserInfoAsync(token.AccessToken);

If I use Azure AD Graph API, I can do it, but with Auth0, that is no way.