Skip to content

[Auth] Underlying Error is always nil #4089

@p-nicolaou

Description

@p-nicolaou

Describe the bug

When a user attempts to sing-in and fails, in this case .notAuthorized() underlying error is always nil.

As a result, if I want to follow a different flow whenever sign-in fails due to "Incorrect username or password" and not "Password attempts exceeded", the only way is to extract the ErrorDescription and compare the String.

This is not a concrete solution as if the ErrorDescription changes for some reason in the future, the above will stop working.

Steps To Reproduce

Steps to reproduce the behavior:
1. Enter incorrect username or password
2. Attempt to .singIn()
3. Consume the AuthError
4. If type .notAuthorized() extract ErrorDescription and underlying Error
5. Underlying error is nil

Expected behavior

There should be a more concrete way to distiguish the cases .notAuthorized() might occur.

Amplify Framework Version

2.51.4

Amplify Categories

Auth

Dependency manager

Swift PM

Swift version

5.10

CLI version

14.0.0

Xcode version

26.0.1 (17A400)

Relevant log output

<details>
<summary>Log Messages</summary>


INSERT LOG MESSAGES HERE

</details>

Is this a regression?

Yes

Regression additional context

No response

Platforms

iOS

OS Version

iOS 15.5

Device

iPhone 6S

Specific to simulators

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions