Change User Pictures

Auth0 normalizes common profile properties in the User Profile, this includes the name and picture field and more. The picture field is populated by either the social provider profile picture or the Gravatar image associated with the user's email address. By default, all database users will have a placeholder image with their initials. When you authenticate the user, this picture field is referred by as user.picture.

User Picture

  1. By default, the user.picture attribute is not directly editable when provided by identity providers other than Auth0 (such as Google, Facebook, Twitter). If you want to be able to edit this attribute, you must configure your connection sync with Auth0 so that user attributes will be updated from the identity provider only on user profile creation. Root attributes will then be available to be edited individually or by bulk import using the Management API.

Alternatively, you can use the Metadata to store the picture attribute for users, but this is not recommended for scalability.

For example, if your app provides a way to upload profile pictures, once the picture is uploaded, you can set the URL to the picture in user.user_metadata.picture:

  1. To ensure that the picture from the user_metadata is returned in the ID Token, you need to create a Rule to check whether the user.user_metadata.picture attribute is present, and if so replace the user.picture attribute with that value. This will ensure that the picture from the user_metadata is returned in the picture claim of the ID Token.

Here is an example of the code you can use in your Rule:

Use cookies with authentication

Change the default picture for all users

To change the default picture of all users who do not have a profile picture set, you can use a rule to do this.


Stateful cookies

Keep reading