Custom data with membership field
-
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
} ], -
@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
andregistration
.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.