Skip to content

Commit 3209874

Browse files
authored
fix(auth): handle deleted account when fetching signed in session (#1604)
1 parent d9adccd commit 3209874

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

AmplifyPlugins/Auth/AWSCognitoAuthPlugin/Dependency/AuthorizationProviderAdapter+SignedInSession.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ extension AuthorizationProviderAdapter {
5858
self.fetchSignedInSession(withError: AuthErrorHelper.toAuthError(error!),
5959
completionHandler)
6060
}
61+
} else if (error as NSError?)?.userInfo["__type"] as? String == "UserNotFoundException" {
62+
self.awsMobileClient.signOutLocally()
63+
self.fetchSignedOutSession(completionHandler)
64+
Amplify.Hub.dispatch(to: .auth, payload: HubPayload(eventName: HubPayload.EventName.Auth.signedOut))
6165
} else {
6266
self.fetchSignedInSession(withError: AuthErrorHelper.toAuthError(error!), completionHandler)
6367
}

0 commit comments

Comments
 (0)