Skip to content

Commit

Permalink
fix(auth): Catch password reset Cognito API error response (#11274)
Browse files Browse the repository at this point in the history
Add isPasswordResetRequiredError
  • Loading branch information
oschwartz10612 committed Jun 26, 2023
1 parent cfd2062 commit 18012b0
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion packages/auth/src/Auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1601,6 +1601,15 @@ export class AuthClass {
);
}

private isPasswordResetRequiredError(
err: any
): err is { message: 'Password reset required for the user' } {
return (
this.isErrorWithMessage(err) &&
err.message === 'Password reset required for the user'
);
}

private isSignedInHostedUI() {
return (
this._oAuthHandler &&
Expand All @@ -1614,7 +1623,8 @@ export class AuthClass {
this.isUserDoesNotExistError(err) ||
this.isTokenRevokedError(err) ||
this.isRefreshTokenRevokedError(err) ||
this.isRefreshTokenExpiredError(err)
this.isRefreshTokenExpiredError(err) ||
this.isPasswordResetRequiredError(err)
);
}

Expand Down

0 comments on commit 18012b0

Please sign in to comment.