Skip to content

Commit 3e9b709

Browse files
authored
chore: Updated the changelog to reflect new auth changes (#1057)
1 parent 3d9a591 commit 3e9b709

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

CHANGELOG.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,39 @@
44

55
### Features
66

7-
- **auth**: Fix cancelling hostedUI returning a generic error (#982)
87
- Support lazy load and pagination for API (#1009)
98
- Separate DataStore List logic out to list provider (#1000)
109

10+
### Behavior Change
11+
12+
- **Auth**: Fix cancelling hostedUI returning a generic error (#982).
13+
14+
When a user cancels the sign in flow from `Amplify.Auth.signInWithWebUI`, the callback will now deliver an error of type `AuthError.service`, with an underlying error of `AWSCognitoAuthError.userCancelled`. Previously, the error was a `SFAuthenticationError.canceledLogin`. The `AuthError.service` error type will be returned regardless of whether the underlying HostedUI operation was performed via an SFAuthenticationSession or an ASWebAuthenticationSession.
15+
16+
You can detect the user cancellation case by `switch`ing on the error, as in:
17+
18+
```swift
19+
switch result {
20+
case .success:
21+
print("SignOut")
22+
case .failure(let error):
23+
if case AuthError.service(_, _, let underlyingError) = error,
24+
case .userCancelled = (underlyingError as? AWSCognitoAuthError) {
25+
print("User cancelled")
26+
}
27+
}
28+
```
29+
30+
### Misc updates
31+
32+
- **Auth**: `Amplify.Auth.signInWithWebUI` now automatically uses `ASWebAuthenticationSession` internally for iOS 13.0+. For older iOS versions, it will fall back to `SFAuthenticationSession`.
33+
This release also introduces a new `preferPrivateSession` flag to `AWSAuthWebUISignInOptions` during the sign in flow. If `preferPrivateSession` is set to `true` during sign in, and the user's preferred browser supports [`ASWebAuthenticationSession.prefersEphemeralWebBrowserSession`](https://developer.apple.com/documentation/authenticationservices/aswebauthenticationsession/3237231-prefersephemeralwebbrowsersessio), the user will not see a web view displayed when they sign out.
34+
35+
```swift
36+
Amplify.Auth.signInWithWebUI(presentationAnchor: self.view.window!,
37+
options: .preferPrivateSession()) { ... }
38+
```
39+
1140
## 1.5.5 (2021-01-26)
1241

1342
### Bug Fixes

0 commit comments

Comments
 (0)