Auth0 Home Blog Docs

? Rule where I set user.fullName works in "Try Rule" but not when actually used

rules

#1

I am playing with the Rules stuff and trying to add a “fullName” attribute to the user.
I set it as
user.fullName =
(user.user_metadata && user.user_metadata.fullName)
? user.user_metadata.fullName
: user.email;

this seems to work when I try the rule, but when I log into the app and it runs, the “fullName” property is not there. Is there a trick to getting this to work?

I double-checked that the “fullName” field is defined in the user_metadata I am logging in with…

thanks!


#2

Can you please clarify where you expect to see the fullName attribute, and where it isn’t appearing? Without knowing this, I’m assuming you want this attribute as a claim in the id_token, for you to use in your frontend. If so, you need to add it to the id_token as a namespaced claim, outlined here:

https://auth0.com/docs/api-auth/tutorials/adoption/scope-custom-claims


#3

I had just wanted to stick it on the user object - I thought I saw somewhere you could do that. But I also saw the stuff about using the namespace and just getting the all the metadata, which seemed to work.


#4

I had just wanted to stick it on the user object - I thought I saw somewhere you could do that. But I also saw the stuff about using the namespace and just getting the all the metadata, which seemed to work.


#5