Hello,
I’m trying to use a post-login action to set a picture property within the user metadata. I’ve created and deployed the following action:
exports.onExecutePostLogin = async (event, api) => {
api.user.setUserMetadata("picture", "https://db3pap007files.storage.live.com/y4mJQhpcRBjwDJkh5aIVjH95pD-085UxR5r1OyQX2-mNOCvqyjghcHimd6KXwSL2W5YeP_AhLN5r4GJYnfcm0SrJowroK4xAh0c8iNWuAiApICBJ9keaiIlAko19bkBqEIQnxJhJY2sQ6LktRppQJLaIaslG5gP9XqECzNqqAUaaxXE5DmBFzu_e3uwX4JebmF0?width=1200&height=1599&cropmode=none");
};
I then incorporated this custom action into the Login flow, between the Start and Complete stages:
However, when I log into my SPA the getUser() method on the auth0 client, I’m not getting the user metadata:
const user = await auth0Client.getUser();
After this call, the user variable contains the basic attributes, e.g. nickname, name, email, etc., but does not have a user metadata attribute.
Can anyone say what I’m doing wrong here or why the user metadata is not being returned?
I noticed that, in the template app from which I created my SPA, the call above was following by this comment:
// Here you should extract the complete user profile to make it available in your entire app.
// The auth state only provides basic information.
Is it the case that the getUser() method only returns a subset of the user profile, and if so, how can I get the complete profile?