Skip to content

Commit 79d3b7a

Browse files
committed
Updated the examples.md file
1 parent f83312c commit 79d3b7a

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

EXAMPLES.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- [Sign Up with a database connection](#sign-up-with-a-database-connection)
1919
- [Get user information](#get-user-information)
2020
- [Custom Token Exchange](#custom-token-exchange)
21+
- [Native to Web SSO login](#native-to-web-sso-login)
2122
- [Credentials Manager](#credentials-manager)
2223
- [Secure Credentials Manager](#secure-credentials-manager)
2324
- [Usage](#usage)
@@ -540,6 +541,64 @@ authentication
540541
</details>
541542

542543

544+
## Native to Web SSO login (Experimental)
545+
> **Warning**
546+
>
547+
> Native to Web SSO login support in Auth0.Android is still experimental and can change in the future.
548+
549+
This feature allows you to authenticate a user in a web session using the refresh token obtained from the native session without requiring the user to log in again.
550+
551+
Call the api to fetch a webSsoToken in exchange for a refresh token. Use the obtained token to authenticate the user by calling the `/authorize` end point.
552+
553+
```kotlin
554+
authentication
555+
.fetchWebSsoToken("refresh_token")
556+
.start(object : Callback<SSOCredentials, AuthenticationException> {
557+
override fun onSuccess(result: SSOCredentials) {
558+
// Use the web_sso token to authenticate the user in a web session in your app
559+
}
560+
561+
override fun onFailure(exception: AuthenticationException) {
562+
// Handle error
563+
}
564+
565+
})
566+
```
567+
568+
<details>
569+
<summary>Using coroutines</summary>
570+
571+
``` kotlin
572+
try {
573+
val ssoCredentials = authentication
574+
.fetchWebSsoToken("refresh_token")
575+
.await()
576+
} catch (e: AuthenticationException) {
577+
e.printStacktrace()
578+
}
579+
```
580+
</details>
581+
582+
<details>
583+
<summary>Using Java</summary>
584+
585+
```java
586+
authentication
587+
.fetchWebSsoToken("refresh_token")
588+
.start(new Callback<SSOCredentials, AuthenticationException>() {
589+
@Override
590+
public void onSuccess(@Nullable SSOCredentials payload) {
591+
// Handle success
592+
}
593+
@Override
594+
public void onFailure(@NonNull AuthenticationException error) {
595+
// Handle error
596+
}
597+
});
598+
```
599+
</details>
600+
601+
543602
## Credentials Manager
544603

545604
### Secure Credentials Manager

0 commit comments

Comments
 (0)