|
18 | 18 | - [Sign Up with a database connection](#sign-up-with-a-database-connection) |
19 | 19 | - [Get user information](#get-user-information) |
20 | 20 | - [Custom Token Exchange](#custom-token-exchange) |
| 21 | + - [Native to Web SSO login](#native-to-web-sso-login) |
21 | 22 | - [Credentials Manager](#credentials-manager) |
22 | 23 | - [Secure Credentials Manager](#secure-credentials-manager) |
23 | 24 | - [Usage](#usage) |
@@ -540,6 +541,64 @@ authentication |
540 | 541 | </details> |
541 | 542 |
|
542 | 543 |
|
| 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 | + |
543 | 602 | ## Credentials Manager |
544 | 603 |
|
545 | 604 | ### Secure Credentials Manager |
|
0 commit comments