• Home
  • Categories
  • Recent
  • Popular
  • Pricing
  • Contact us
  • Docs
  • Login
FusionAuth
  • Home
  • Categories
  • Recent
  • Popular
  • Pricing
  • Contact us
  • Docs
  • Login

Get user email in claims with saml

Scheduled Pinned Locked Moved
General Discussion
3
10
10.1k
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B
    bartetlau
    last edited by 16 Apr 2025, 16:40

    Hi,

    I m using FusionAuth with SAML and Azure AD.
    In my project .net, I use the api oauth2/token to get a token with a code given by the redirect url in front.
    In this token, I have claims but I would like to have the userEmail from azure ad.
    How do that please?

    M 1 Reply Last reply 17 Apr 2025, 15:30 Reply Quote 0
    • M
      mark.robustelli @bartetlau
      last edited by 17 Apr 2025, 15:30

      @bartetlau Have you had a chance to check out FusionAuth Lambdas? Specifically, SAML v2 Populate Lambda? Does that get you what you need?

      1 Reply Last reply Reply Quote 0
      • L
        laurent.bartet
        last edited by 22 Apr 2025, 14:55

        Hi,

        Thank you for your reply,

        I created a lambda very simple:

        // Using the samlResponse, reconcile the User and User Registration.
        function reconcile(user, registration, samlResponse) {
        console.debug("Lambda Start");
        user.data = user.data || {};
        user.data.country = "France";
        console.log('Lambda finish!');
        }

        Assigned to the good identity but finaly user.data is void and I don't have log events or debug envents.
        I don't know if it's running.

        Thanks,

        M 1 Reply Last reply 22 Apr 2025, 18:33 Reply Quote 0
        • M
          mark.robustelli @laurent.bartet
          last edited by mark.robustelli 22 Apr 2025, 18:33

          @laurent-bartet

          What kind of Lambda did you create? Did you assign the Lamba to the application?

          If it was SAML V2 Poulate then make sure it is assigned to your application.

          Applications -> {Your Application} -> SAML tab -> Authentication response -> Populate Lambda -> {Choose the lambda you created}

          Also make sure you have Debug enabled set on the Lambda.

          Let me know if this helps.

          L 1 Reply Last reply 23 Apr 2025, 08:02 Reply Quote 0
          • L
            laurent.bartet @mark.robustelli
            last edited by 23 Apr 2025, 08:02

            @mark-robustelli

            It's a Reconcile assigned to a saml identity provider but I have nothing in event log, the Debug mode is activated.
            You can see my screenshots.
            Screenshot_1.png Screenshot_3.png Screenshot_4.png Screenshot_5.png

            M 1 Reply Last reply 23 Apr 2025, 15:13 Reply Quote 0
            • M
              mark.robustelli @laurent.bartet
              last edited by 23 Apr 2025, 15:13

              @laurent-bartet Since it is a SAML reconcile lambda, do you have it assigned to the Identity Provider?

              Settings -> Identity Providers -> {Your SAML v2 Identity Provider} -> Edit -> Reconcile Lambda

              Screenshot 2025-04-23 at 8.08.28 AM.png

              1 Reply Last reply Reply Quote 0
              • L
                laurent.bartet
                last edited by 24 Apr 2025, 07:56

                Yes it was assigned to a saml identity provider:

                d5531a4b-f291-4d82-9cbf-02e9452787a1-image.png

                M 1 Reply Last reply 30 days ago Reply Quote 0
                • M
                  mark.robustelli @laurent.bartet
                  last edited by 30 days ago

                  @laurent-bartet hmm.., since the lambda seems to be set up correctly but appears to not be hitting, let's take a step back and look at the configuration. Can you tell me a little more about that? What identity providers you are using and how they are configured? I read you are using SAML, but it appears in the log that you are using OAuth2. If you are using OAuth2, you might be able to use a JWT populate lambda in that case, but would like to know more about your setup.

                  L 1 Reply Last reply 29 days ago Reply Quote 0
                  • L
                    laurent.bartet @mark.robustelli
                    last edited by 29 days ago

                    @mark-robustelli
                    Hi,

                    I found my problem, I had to use the fusionauth logout before.
                    Now all is ok.
                    Thank you for your help!

                    M 1 Reply Last reply 29 days ago Reply Quote 0
                    • M
                      mark.robustelli @laurent.bartet
                      last edited by 29 days ago

                      @laurent-bartet awesome! So it sounds like you had things set up right, you just were not logged out, so when you went back the reconcile event never took place cause you were already logged in. Is that right?

                      1 Reply Last reply Reply Quote 0
                      7 out of 10
                      • First post
                        7/10
                        Last post