How to retrieve organization picture?

Hello, guys.

  const { user, isAuthenticated, isLoading } = useAuth0();
  console.log(user)

This above code, shows on console the following information about my currently logged in user… for example:

{nickname: 'ftamez90', name: 'ftamez90@gmail.com', picture: 'https://s.gravatar.com/avatar/75702d21d7615970fda6…&d=https%3A%2F%2Fcdn.auth0.com%2Favatars%2Fft.png', updated_at: '2021-09-06T23:44:48.042Z', email: 'ftamez90@gmail.com', …}
email: "ftamez90@gmail.com"
email_verified: true
name: "ftamez90@gmail.com"
nickname: "ftamez90"
org_id: "org_ArJoLewFsXIxWWJ7"
picture: "https://s.gravatar.com/avatar/75702d21d7615970fda6c8a7705cd18d?s=480&r=pg&d=https%3A%2F%2Fcdn.auth0.com%2Favatars%2Fft.png"
sub: "auth0|6136996f4f28ac006bd79949"
updated_at: "2021-09-06T23:44:48.

I see that I can get the “org_id” which is great, but I want to know how can I retrieve the picture of the organization of the currently logged in user?

Please let me know, Thanks

Hi @ftamez,

Welcome to the Auth0 Community!

There is not a straightforward way to get the logo URL from the org in the user profile. You can add custom data to your organization with metadata. This would be a good place to store a URL pointing to a picture for your org:

You can then add that URL to the user object with a custom claim in an action.

Organization metadata is available in actions through the event.organization.metadata object.

If you have any trouble, let me know. I would be happy to help you work out the details of the Action.

Thank you very much, let me go read and implement this idea.

Appreciate it,

FT

I see the info but I dont know where I have to call this…

do you guys have a video tutorial? Explaining how this actions work?

That will be really helpfull,

Enrich the user profile

Auth0 provides a system for storing metadata on a User Profile. In order to set user_metadata or app_metadata on a user’s profile during their login, use the api.user.setUserMetadata or api.user.setAppMetadata functions.

/**
 * @param {Event} event - Details about the user and the context in which they are logging in.
 * @param {PostLoginAPI} api - Interface whose methods can be used to change the behavior of the login.
 */
exports.onExecutePostLogin = async (event, api) => {
  api.user.setUserMetadata("favorite_color", "blue");
};

First I Thought it was super easy but i did everthing as the tutorial explained but still not able to see the “logo_img”…

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.