0

Retrieving additional fields/claims from Azure AD

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #52903
    loada
    Member

      Dear Eben!

      I purchased your template for a project and it’s been really great. It runs perfectly and has saved me a ton amount of time.

      I’m using it with Azure and I’ll like to retrieve some extra fields/claims in addition to the email from active directory. In the project the email is already present when you login with Microsoft and I’ll like to add some additional claims from Azure AD.

      Any tips as to how to accomplish this in code?

      Best regards,
      Sam

      #52906

      Hello Sam,

      Thank you for choosing QuickApp for your project and thank you for your purchase!

      Please follow the below steps to add your additional fields from Azure AD

      1. In Azure AD, ensure your extra claims are included in the idToken. See this Azure post on how to do that: Provide optional claims to Azure AD apps – Microsoft Learn
      2. In QuickApp, in the “ProfileService.cs” file add the below lines to the method GetProfileDataAsync. This will add your Azure AD claims to the accessToken and your Azure claims will be accessible from code:
        List azureADClaims = context.Subject.Claims
        .Where(c => c.Type == "Your_AzureAD_Claim1" || c.Type == "Your_AzureAD_Claim2").ToList();
        claims.AddRange(azureADClaims)
        

      Hope this helps

      #52964
      loada
      Member
      Topic Author

        Dear Eben,

        Many thanks for your help. I have it working now!

        Many thanks.
        Sam

      Viewing 3 posts - 1 through 3 (of 3 total)
      • You must be logged in to reply to this topic.