Change User Pictures
Auth0 normalizes common profile properties in the User Profile, this includes the
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
- By default, the
user.pictureattribute 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
- To ensure that the picture from the
user_metadatais returned in the ID Token, you need to create a Rule to check whether the
user.user_metadata.pictureattribute is present, and if so replace the
user.pictureattribute with that value. This will ensure that the picture from the
user_metadatais returned in the
pictureclaim of the ID Token.
Here is an example of the code you can use in your Rule:
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.