Custom DB Login Error: Missing Identifying Attribute in Profile

Overview

This article explains the cause of an error encountered when executing the “login” action script associated with an Auth0 Custom Database connection. The specific error message observed is:

Returned profile does not contain specified identifying attribute

Applies To

  • Custom Database
  • Flexibile identifiers

Cause

This error indicates the profile object returned by the Custom Database login script contains a different identifying attribute value than what was used for the login attempt. The specific identifying attribute depends on the connection’s Flexible Identifiers configuration. See Flexible Identifiers and Attributes and Activating and Configuring Attributes for Flexible Identifiers for more details.

Solution

Modify the Custom Database ‘login’ script to ensure the returned profile object contains the exact identifying attribute and value used for the login attempt.

For example, if the login uses phone_number, the returned profile must include a phone_number attribute with the identical value submitted by the user. A missing attribute or mismatched value in the returned profile causes this error.