Identify the User

Users consist of a few critical pieces of information that construct a unique identity in Sentry. Each of these is optional, but one must be present for the Sentry SDK to capture the user:

id
Your internal identifier for the user.

username
The username. Typically used as a better label than the internal id.

email
An alternative (or addition) to the username. Sentry is aware of email addresses and can display things such as Gravatars and unlock messaging capabilities.

ip_address
The user's IP address. If the user is unauthenticated, Sentry uses the IP address as a unique identifier for the user. Sentry will attempt to pull this from the HTTP request data, if available.

To identify the user:

Copied
using Sentry;

SentrySdk.ConfigureScope(scope =>
{
    scope.User = new User
    {
        Email = "john.doe@example.com"
    };
});

Additional key/value pairs can be specified as metadata and the Sentry SDK will store those with the user.

The platform or SDK you've selected either does not support this functionality, or it is missing from documentation.

If you think this is an error, feel free to let us know on GitHub.

You can edit this page on GitHub.