Skip to content

Commit

Permalink
Update Single Sign-on with Authgear doc
Browse files Browse the repository at this point in the history
  • Loading branch information
louischan-oursky committed Dec 6, 2022
2 parents caf4609 + ec19b05 commit 71110ae
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 11 deletions.
2 changes: 1 addition & 1 deletion SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
* [User Profile](integrate/user-profile.md)
* [Reauthentication](integrate/reauthentication.md)
* [How Authgear integrate with your applications](integrate/how-authgear-integrate-with-your-applications.md)
* [Single Sign-on on mobile devices](integrate/single-sign-on.md)
* [Single Sign-on](integrate/single-sign-on.md)
* [Force authentication on app launch](integrate/force-authentication-on-app-launch.md)
* [Account Deletion](integrate/account-deletion.md)
* [Using Authgear as an OpenID Connect Provider](integrate/oidc-provider.md)
Expand Down
39 changes: 29 additions & 10 deletions integrate/single-sign-on.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,41 @@ description: >-
sign-on feature.
---

# Single Sign-on on mobile devices
# Single Sign-on

On mobile devices, Authgear uses a webview that can be configured to share the cookie with the system browser. The system browser is Safari on iOS, while the system browser is Chrome on Android. If you have both a mobile application and a website, you can enable the Single Sign-on feature so that
Single sign-on (SSO) is defined as login once, logged in all apps. If you have multiple mobile apps or websites that use the same Authgear project. You can configure your apps to turn on the SSO feature, so the end-users only have to enter their authentication credentials once.

1. **From Apps to Website:** The end-user installs your app and signs in. Later on, when they visit your website with the system browser, they will be already signed in.
2. **From Website to Apps:** The end-user has been using your website. One day they decided to install your app. When they log in to the app, they will see a **continue screen** so that they can log in with just a click, without authenticating themselves again.
If you are building cookie-based websites with the same root domain (e.g. `app1.example.com` / `app2.example.com`), you can skip this section. Sessions are shared among `*.example.com` automatically, see [detail](../get-started/authentication-approach/cookie-based.md).

You can turn on this feature when you configure the SDK by setting the `shareSessionWithSystemBrowser` option to `true`.
If you are building token-based websites or mobile apps, you can enable the SSO feature via the SDK.

When SSO-enabled is ON, the end-user will need to enter their authentication credentials when they login to the first app. Later on, when they login to the second app, they will see a **continue screen** so that they can log in with just a click, without authenticating themselves again.

{% hint style="info" %}
It is important that when the SSO feature is ON, don't set the `prompt` parameter when authenticating (e.g. `prompt=login`). Otherwise, the end-user will need to login again.
{% endhint %}

When the end-user logout the SSO-enabled app, all the apps will be logged out at the same time.

You can turn on this feature when you configure the SDK by setting the **is sso enabled** option to `true`.

{% tabs %}
{% tab title="Web" %}
```typescript
authgear.configure({
clientID: CLIENT_ID,
endpoint: ENDPOINT,
sessionType: "refresh_token",
isSSOEnabled: true,
});
```
{% endtab %}
{% tab title="React Native" %}
```typescript
authgear.configure({
clientID: CLIENT_ID,
endpoint: ENDPOINT,
shareSessionWithSystemBrowser: true,
isSSOEnabled: true,
});
```
{% endtab %}
Expand All @@ -29,7 +48,7 @@ authgear.configure({
final authgear = Authgear(
clientID: CLIENT_ID,
endpoint: ENDPOINT,
shareSessionWithSystemBrowser: true,
isSsoEnabled: true,
);
```
{% endtab %}
Expand All @@ -40,7 +59,7 @@ var authgearOptions = new AuthgearOptions
{
ClientId = CLIENT_ID,
AuthgearEndpoint = ENDPOINT,
ShareSessionWithSystemBrowser = true,
IsSsoEnabled = true,
};
// Android
#if __ANDROID__
Expand All @@ -58,7 +77,7 @@ var authgear = new AuthgearSdk(UIKit.UIApplication.SharedApplication, authgearOp
Authgear(
clientId: CLIENT_ID,
endpoint: ENDPOINT,
shareSessionWithSystemBrowser: true,
isSSOEnabled: true,
)
```
{% endtab %}
Expand All @@ -70,7 +89,7 @@ new Authgear(
CLIENT_ID,
ENDPOINT,
null, // tokenStorage = default
true // shareSessionWithSystemBrowser = true
true // isSsoEnabled = true
);
```
{% endtab %}
Expand Down

0 comments on commit 71110ae

Please sign in to comment.