Hi,
I’m able to login and signup to my Auth0 forms.
I’ve been able to add custom meta data on the sign up form such as “first_name”.
I would like my Angular app to receive “first_name” in the user object that I’m listening to after login.
Example of my login code:
this.authService.user$.subscribe((user: any) => {
if (user) {
console.log(user);
const test1 = user['http://localhost:4200/first_name'];
console.log(test1);
}
})
I see the user object but no first_name.
The user I login with has first_name able as meta_data (which I see populated in user management).
Next I made a new action called user-meta-action and deployed it / added to the login flow diagram.
This is my action code in Auth0:
exports.onExecutePostLogin = async (event, api) => {
const namespace = 'http://localhost:4200/';
const { first_name } = event.user.user_metadata;
if (event.authorization) {
api.user.setUserMetadata(`${namespace}/first_name`, first_name);
}
};
Issue:
I think the issue I’m having is I don’t know what to set namespace to in the action code?
Furthermore, I’m unsure if my angular code is correct for calling the first_name claim.
I’ve checked the logs and it seems the action is firing but no user data being return.
Weirdly the data shows in the actions test play if I hard code first_name to like dave.
However, that doesn’t show either in the logs.
Logs:
Action test (just trying to get it working with dave hard coded):
I look forward to your response.