File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
AmplifyPlugins/Auth/AWSCognitoAuthPlugin/Dependency Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ extension AuthorizationProviderAdapter {
58
58
self . fetchSignedInSession ( withError: AuthErrorHelper . toAuthError ( error!) ,
59
59
completionHandler)
60
60
}
61
- } else if ( error as NSError ? ) ? . userInfo [ " __type " ] as? String == " UserNotFoundException " {
61
+ } else if self . isErrorCausedByUserNotFound ( error) {
62
62
self . awsMobileClient. signOutLocally ( )
63
63
self . fetchSignedOutSession ( completionHandler)
64
64
Amplify . Hub. dispatch ( to: . auth, payload: HubPayload ( eventName: HubPayload . EventName. Auth. signedOut) )
@@ -252,4 +252,13 @@ extension AuthorizationProviderAdapter {
252
252
}
253
253
return false
254
254
}
255
+
256
+ private func isErrorCausedByUserNotFound( _ error: Error ? ) -> Bool {
257
+ if let cognitoIdentityProviderError = error as NSError ? ,
258
+ cognitoIdentityProviderError. domain == AWSCognitoIdentityProviderErrorDomain,
259
+ cognitoIdentityProviderError. code == AWSCognitoIdentityProviderErrorType . userNotFound. rawValue {
260
+ return true
261
+ }
262
+ return false
263
+ }
255
264
}
You can’t perform that action at this time.
0 commit comments