Remove the Gravatar Image for a Specific User

Last Updated: Nov 14, 2024

Overview

The user profile may display an automatically associated Gravatar image. In some circumstances, it may be desirable to update/remove the Gravatar image for a specific user.

This article explains how to update or remove the Gravatar image and provides additional information about the configuration.

Applies To

  • Gravatar Image

Cause

Gravatar is a cloud-based service that hosts a custom picture of an individual user. Auth0 uses the Gravatar service to automatically populate the user.picture profile attribute based on the user’s email address. Auth0 references the image stored externally on Gravatar’s servers rather than storing the image directly. This behavior prevents the direct removal or editing of the Gravatar source image from within the Auth0 user profile.

The user.picture attribute is a normalized root attribute in the User Profile Structure and, by default, displays a placeholder image for database connections without a Gravatar match. The Gravatar image takes precedence unless overridden for users with an email associated with a Gravatar account.

Setting "gravatar_disabled": true in user_metadata is ineffective for removing the Gravatar image.

NOTE: The user.picture attribute can only be directly edited if the user account is associated with an Auth0 database connection.

Solution

The method to change or replace the user’s picture, including images sourced from Gravatar, depends on the connection type as explained in the Change User’s Pictures documentation:

1. Social Connections (e.g., Google, Facebook, X)

  • For users authenticating via social providers, the profile picture displayed in Auth0 often originates from that identity provider. Here are a few Sample User Profiles that illustrate how the user picture is stored within these types of social providers.
  • To edit this picture, it is necessary to configure connection sync with Auth0 so that user attributes will be updated from the identity provider only on user profile creation. It is then possible to edit root attributes individually using the Management API, as explained in Configure Identity Provider Connection for User Profile Updates.

2. Auth0 Database Connections

For users authenticating via an Auth0 database connection, the picture can be explicitly set or changed using the Auth0 Management API. This will override any image previously pulled from Gravatar.

  1. Obtain the user_id for the target user profile.
  2. Prepare a PATCH request for the Management API endpoint: /api/v2/users/{id} . Replace {id} with the actual user_id.
  3. Construct a JSON body for the request. To set the primary picture attribute, include the picture field with the URL of the new image:
{
  "picture": "http://example.com/new-picture.png"
}

NOTE: Assign an empty string to the picture attribute to remove a user’s picture.

  1. Execute the Management API request using a valid Management API token for authentication.

NOTE: Setting the root picture attribute is the standard way to manage the user’s primary profile image for database connections. While user_metadata can also store picture information, updating the root picture attribute directly is generally recommended for overriding the default Gravatar or placeholder.

Additionally, while using Classic Universal login, it is possible that specific ‘gravatar’ control options may appear within the context of individual product features, such as the Lock configuration. However, for all other purposes, the general approach described in this document should be followed.