JWT populate with tenant information
-
Hi,
Is there a way to populate the JWT with the tenant name? As far as I know, the place to add additional information to the JWT is the 'JWT Populate' lambda. In there I can access the user object. However that only holds the tenant-id, not the tenant-name.
Workarounds which I see:
- Store the tenant-name in the user data (feels unclean and we need to make sure it happens each time when a new user gets created)
- Translate the uuid to the tenant name in the service which validates the JTW (adds overhead there)
Is there an easy way to achieve my goal or do you see another workaround?
-
Hiya,
Yup, you've encountered a known limit of the lambda functionality. The two options you outline are the ones I'd consider. You could update the user data with the tenant name on create using a webhook, so maybe not as messy as you might think.
The only other option would be to file a github issue requesting the tenant information be made available in the lambda: https://github.com/fusionauth/fusionauth-issues/issues
There are some similar issues I'd suggest voting up if this is important to you:
https://github.com/FusionAuth/fusionauth-issues/issues/571
https://github.com/FusionAuth/fusionauth-issues/issues/267
https://github.com/FusionAuth/fusionauth-issues/issues/229