Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/constants/versions.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
export const versions = {
ANDROID_VERSION: '2.24.0',
ANDROID_VERSION: '2.30.0',
ANDROID_DEVPREVIEW: '1.36.5-dev-preview.0',
ANDROID_V1_VERSION: '1.38.8',
ANDROID_V1_GEO_VERSION: '1.0.1',
ANDROID_V1_KOTLIN_VERSION: '0.22.8',
ANDROID_SDK_VERSION: '2.76.0',
KOTLIN_SDK_VERSION: '1.3.31',
ANDROID_AUTHENTICATOR_VERSION: '1.4.0',
ANDROID_SDK_VERSION: '2.81.0',
KOTLIN_SDK_VERSION: '1.5.15',
ANDROID_AUTHENTICATOR_VERSION: '1.6.0',
ANDROID_APPSYNC_SDK_VERSION: '1.0.0'
};
10 changes: 10 additions & 0 deletions src/fragments/lib/auth/ios/signin_web_ui/40_private_session.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,14 @@ try await Amplify.Auth.signInWithWebUI(
) {
...
}

// or

try await Amplify.Auth.signInWithSocialWebUI(
for: .googleSignIn,
presentationAnchor: self.view.window!,
options: .preferPrivateSession()
) {
...
}
```
109 changes: 109 additions & 0 deletions src/fragments/lib/auth/native_common/signin_web_ui/common.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,112 @@ import ios12 from '/src/fragments/lib/auth/ios/signin_web_ui/40_private_session.
import flutter13 from '/src/fragments/lib/auth/flutter/signin_web_ui/40_private_session.mdx';

<Fragments fragments={{ flutter: flutter13 }} />

<InlineFilter filters={['android']}>
### Prefer private session during signIn

The `preferPrivateSession` option launches the authentication flow in an ephemeral browser state with no existing sessions or cookies. This ensures each authentication attempt begins from a clean, signed-out state, which is particularly useful for social sign-ins where third-party authentication cookies cannot be cleared.

<BlockSwitcher>
<Block name="Java">

```java
AWSCognitoAuthWebUISignInOptions options = AWSCognitoAuthWebUISignInOptions.builder()
.preferPrivateSession(true)
.build();

Amplify.Auth.signInWithWebUI(
this,
options,
result -> Log.i("AuthQuickStart", result.toString()),
error -> Log.e("AuthQuickStart", error.toString())
);

// or

Amplify.Auth.signInWithSocialWebUI(
AuthProvider.google(),
this,
options,
result -> Log.i("AuthQuickStart", result.toString()),
error -> Log.e("AuthQuickStart", error.toString())
);
```

</Block>
<Block name="Kotlin - Callbacks">

```kotlin
val options = AWSCognitoAuthWebUISignInOptions.builder()
.preferPrivateSession(true)
.build()

Amplify.Auth.signInWithWebUI(
this,
options,
{ Log.i("AuthQuickStart", "Signin OK = $it") },
{ Log.e("AuthQuickStart", "Signin failed", it) }
)

// or

Amplify.Auth.signInWithSocialWebUI(
AuthProvider.google(),
this,
options,
{ Log.i("AuthQuickStart", "Signin OK = $it") },
{ Log.e("AuthQuickStart", "Signin failed", it) }
)
```

</Block>
<Block name="Kotlin - Coroutines">

```kotlin
val options = AWSCognitoAuthWebUISignInOptions.builder()
.preferPrivateSession(true)
.build()

try {
val result = Amplify.Auth.signInWithWebUI(this, options)
Log.i("AuthQuickStart", "Signin OK: $result")
} catch (error: AuthException) {
Log.e("AuthQuickStart", "Signin failed", error)
}

// or

try {
val result = Amplify.Auth.signInWithSocialWebUI(AuthProvider.google(), this, options)
Log.i("AuthQuickStart", "Signin OK: $result")
} catch (error: AuthException) {
Log.e("AuthQuickStart", "Signin failed", error)
}
```

</Block>
<Block name="RxJava">

```java
AWSCognitoAuthWebUISignInOptions options = AWSCognitoAuthWebUISignInOptions.builder()
.preferPrivateSession(true)
.build();

RxAmplify.Auth.signInWithWebUI(this, options)
.subscribe(
result -> Log.i("AuthQuickStart", result.toString()),
error -> Log.e("AuthQuickStart", error.toString())
);

// or

RxAmplify.Auth.signInWithSocialWebUI(AuthProvider.google(), this, options)
.subscribe(
result -> Log.i("AuthQuickStart", result.toString()),
error -> Log.e("AuthQuickStart", error.toString())
);
```

</Block>
</BlockSwitcher>
</InlineFilter>
Original file line number Diff line number Diff line change
Expand Up @@ -1052,6 +1052,82 @@ RxAmplify.Auth.signInWithSocialWebUI(AuthProvider.facebook(), this)
</Block>
</BlockSwitcher>

### Prefer private session during social Sign In

The `preferPrivateSession` option launches the authentication flow in an ephemeral browser state with no existing sessions or cookies. This ensures each authentication attempt begins from a clean, signed-out state, which is particularly useful for social sign-ins where third-party authentication cookies cannot be cleared programmatically.

<BlockSwitcher>
<Block name="Java">

```java
AWSCognitoAuthWebUISignInOptions options = AWSCognitoAuthWebUISignInOptions.builder()
.preferPrivateSession(true)
.build();

// Replace facebook with your chosen auth provider such as google, amazon, or apple
Amplify.Auth.signInWithSocialWebUI(
AuthProvider.facebook(),
this,
options,
result -> Log.i("AuthQuickstart", result.toString()),
error -> Log.e("AuthQuickstart", error.toString())
);
```

</Block>
<Block name="Kotlin - Callbacks">

```kotlin
val options = AWSCognitoAuthWebUISignInOptions.builder()
.preferPrivateSession(true)
.build()

// Replace facebook with your chosen auth provider such as google, amazon, or apple
Amplify.Auth.signInWithSocialWebUI(
AuthProvider.facebook(),
this,
options,
{ Log.i("AuthQuickstart", "Sign in OK: $it") },
{ Log.e("AuthQuickstart", "Sign in failed", it) }
)
```

</Block>
<Block name="Kotlin - Coroutines">

```kotlin
val options = AWSCognitoAuthWebUISignInOptions.builder()
.preferPrivateSession(true)
.build()

try {
// Replace facebook with your chosen auth provider such as google, amazon, or apple
val result = Amplify.Auth.signInWithSocialWebUI(AuthProvider.facebook(), this, options)
Log.i("AuthQuickstart", "Sign in OK: $result")
} catch (error: AuthException) {
Log.e("AuthQuickstart", "Sign in failed", error)
}
```

</Block>
<Block name="RxJava">

```java
AWSCognitoAuthWebUISignInOptions options = AWSCognitoAuthWebUISignInOptions.builder()
.preferPrivateSession(true)
.build();

// Replace facebook with your chosen auth provider such as google, amazon, or apple
RxAmplify.Auth.signInWithSocialWebUI(AuthProvider.facebook(), this, options)
.subscribe(
result -> Log.i("AuthQuickstart", result.toString()),
error -> Log.e("AuthQuickstart", error.toString())
);
```

</Block>
</BlockSwitcher>

</InlineFilter>

<InlineFilter filters={['swift']}>
Expand Down Expand Up @@ -1133,6 +1209,59 @@ func socialSignInWithWebUI() -> AnyCancellable {
</Block>
</BlockSwitcher>

### Prefer private session during social Sign In

The `preferPrivateSession` option launches the authentication flow in an ephemeral browser state with no existing sessions or cookies. This ensures each authentication attempt begins from a clean, signed-out state, which is particularly useful for social sign-ins where third-party authentication cookies cannot be cleared programmatically.

<BlockSwitcher>
<Block name="Async/Await">

```swift
func socialSignInWithWebUI() async {
do {
let signInResult = try await Amplify.Auth.signInWithWebUI(
for: .facebook,
presentationAnchor: self.view.window!,
options: .preferPrivateSession()
)
if signInResult.isSignedIn {
print("Sign in succeeded")
}
} catch let error as AuthError {
print("Sign in failed \(error)")
} catch {
print("Unexpected error: \(error)")
}
}
```

</Block>
<Block name="Combine">

```swift
func socialSignInWithWebUI() -> AnyCancellable {
Amplify.Publisher.create {
try await Amplify.Auth.signInWithWebUI(
for: .facebook,
presentationAnchor: self.view.window!,
options: .preferPrivateSession()
)
}.sink {
if case let .failure(authError) = $0 {
print("Sign in failed \(authError)")
}
}
receiveValue: { signInResult in
if signInResult.isSignedIn {
print("Sign in succeeded")
}
}
}
```

</Block>
</BlockSwitcher>

</InlineFilter>

<InlineFilter filters={["angular", "javascript", "nextjs", "react", "react-native", "vue", "swift", "android"]}>
Expand Down
Loading