File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
AmplifyPlugins/Auth/AWSCognitoAuthPlugin/Dependency Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -260,9 +260,25 @@ extension AuthenticationProviderAdapter {
260
260
break
261
261
}
262
262
}
263
+ if self . isErrorCausedByBadRequest ( error) {
264
+ let errorDescription = error. _userInfo ? [ " error " ] ?
265
+ . description. trimmingCharacters ( in: . whitespaces) ?? " unknown error "
266
+ return AuthError . service ( errorDescription,
267
+ AuthPluginErrorConstants . hostedUIBadRequestError,
268
+ error)
269
+ }
263
270
let authError = AuthErrorHelper . toAuthError ( error)
264
271
return authError
265
272
}
273
+
274
+ private func isErrorCausedByBadRequest( _ error: Error ? ) -> Bool {
275
+ if let cognitoAuthError = error as NSError ? ,
276
+ cognitoAuthError. domain == AWSCognitoAuthErrorDomain,
277
+ cognitoAuthError. code == AWSCognitoAuthClientErrorType . errorBadRequest. rawValue {
278
+ return true
279
+ }
280
+ return false
281
+ }
266
282
267
283
private class ModalPresentingNavigationController : UINavigationController {
268
284
You can’t perform that action at this time.
0 commit comments