Skip to content

[Auth] Reported username depends on AuthFlow used #3151

@mattcreaser

Description

@mattcreaser

Before opening, please confirm:

Language and Async Model

Not applicable

Amplify Categories

Authentication

Gradle script dependencies

// Put output below this line

Environment information

# Put output below this line


Please include any relevant guides or documentation you're referencing

No response

Describe the bug

If you sign in to a user using an email address (or phone number) as the sign in attribute when using the USER_AUTH flow then when you call Amplify.Auth.getCurrentUser().username the value returned will be the attribute to used to sign in. With all other flows the value returned is the actual username.

Reproduction steps (if applicable)

  1. User a userpool with email and/or phonenumber as a sign in attribute. Have USER_AUTH and USER_SRP_AUTH both enabled in the app client.
  2. Use an email address (or phone number) to sign in with a created user via the USER_AUTH flow.
  3. Call getCurrentUser() and observe the username.
  4. Sign out
  5. Sign in to the same user using USER_SRP_AUTH.
  6. Call getCurrentUser() and observe the username.

Expected: The username is the same in both cases since it's the same user.
Actual: In USER_AUTH the username is reported as the email address, in USER_SRP_AUTH it's the username (which may be a UUID if no username was supplied at sign up).

Code Snippet

// Put your code below this line.

Log output

// Put your logs below this line


Configuration File

No response

GraphQL Schema

// Put your schema below this line

Additional information and screenshots

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    authRelated to the Auth category/pluginsbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions