Skip to content

Enabled identifiers duplicated as required and optional when flexible identifiers not enabled #327

@johnnywalker

Description

@johnnywalker

Description

The useSignupIdentifiers hook returns the following when username is not required and flexible identifiers are not enabled:

[
  {
    "type": "email",
    "required": true
  },
  {
    "type": "email",
    "required": false
  }
]

Expected result:

[
  {
    "type": "email",
    "required": true
  }
]

Reproduction

Screen context:

{
  "prompt": {
    "name": "signup"
  },
  "screen": {
    "name": "signup"
  },
  "transaction": {
    "connection": {
      "name": "Username-Password-Authentication",
      "options": {
        "authentication_methods": {
          "passkey": {
            "enabled": false
          },
          "password": {
            "enabled": true,
            "min_length": 8,
            "policy": "good"
          }
        },
        "forgot_password_enabled": true,
        "signup_enabled": true
      },
      "strategy": "auth0"
    },
    "locale": "en",
    "state": "hLJ47LrwjYHjCx9tBWqOCdkweUFzYmFQ"
  }
}

Component:

import {useSignupIdentifiers} from '@auth0/auth0-acul-react/signup'

export function SignupForm() {
  // Get identifiers from transaction
  const enabledIdentifiers = useSignupIdentifiers()

  console.log(enabledIdentifiers)

  return null
}

**Note:** This issue is not present when `transaction.connection.options.attributes` is present in the screen context. E.g.

```json
{
  "prompt": {
    "name": "signup"
  },
  "screen": {
    "name": "signup"
  },
  "transaction": {
    "connection": {
      "name": "Username-Password-Authentication",
      "options": {
        "attributes": {
          "email": {
            "identifier_active": true,
            "signup_status": "required"
          }
        },
        "authentication_methods": {
          "passkey": {
            "enabled": false
          },
          "password": {
            "enabled": true,
            "min_length": 8,
            "policy": "good"
          }
        },
        "forgot_password_enabled": true,
        "signup_enabled": true
      },
      "strategy": "auth0"
    },
    "locale": "en",
    "state": "hLJ47LrwjYHjCx9tBWqOCdkweUFzYmFQ"
  }
}

Environment

  • Version of this library used: @auth0/auth0-acul-react@1.2.0
  • Version of the platform or framework used, if applicable: React
  • Other relevant versions (language, server software, OS, browser): Linux, Vite, Firefox
  • Other modules/plugins/libraries that might be involved: N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions