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

    Custom data with membership field

    Scheduled Pinned Locked Moved Unsolved
    Q&A
    2
    2
    497
    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.
    • S
      sandesh
      last edited by

      I wanted to know if we can pass a custom data with membership field with JWT token.

      If yes, can we configure a field from front end like we can do for a User registration page where the field is passed as user.data.fieldName.

      Similarly, membership new data will be passed as user.memberships.data.fieldName.

      Or

      How we can populate the data in below JSON snippet -

      "memberships" : [ {
      "data" : { },
      "groupId" : "dba95e46-3bbf-4b9f-8956-4bddf73097ca",
      "id" : "54ec6caa-c335-484e-b062-0aa480745b45",
      "insertInstant" : 1691132150760
      } ],

      danD 1 Reply Last reply Reply Quote 0
      • danD
        dan @sandesh
        last edited by

        @sandesh Thanks for using FusionAuth!

        I wanted to know if we can pass a custom data with membership field with JWT token.

        You should be able to grab it out of user.memberships in the JWT populate lambda. I just tested this out:

          console.log('membs: '+JSON.stringify(user.memberships));
        

        and I see the data field.

        If yes, can we configure a field from front end like we can do for a User registration page where the field is passed as user.data.fieldName.

        This is not possible now. The only objects on which you can set custom data using the registration form are user and registration.

        Since you can't add a membership at registration time, I'd suggest using a webhook on registration completion to populate the membership.data field.

        --
        FusionAuth - Auth for devs, built by devs.
        https://fusionauth.io

        1 Reply Last reply Reply Quote 1
        • First post
          Last post