Skip to content

Commit

Permalink
Example doc changes (#796)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmathew92 authored Feb 6, 2025
2 parents ef6d872 + 9f1e8f6 commit 1364458
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions EXAMPLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
- [Step 2: Input the code](#step-2-input-the-code)
- [Sign Up with a database connection](#sign-up-with-a-database-connection)
- [Get user information](#get-user-information)
- [Custom Token Exchange](#custom-token-exchange)
- [Credentials Manager](#credentials-manager)
- [Secure Credentials Manager](#secure-credentials-manager)
- [Usage](#usage)
Expand Down Expand Up @@ -487,6 +488,57 @@ authentication
```
</details>

### Custom Token Exchange

```kotlin
authentication
.customTokenExchange("subject_token_type", "subject_token")
.start(object : Callback<Credentials, AuthenticationException> {
override fun onSuccess(result: Credentials) {
// Handle success
}

override fun onFailure(exception: AuthenticationException) {
// Handle error
}

})
```
<details>
<summary>Using coroutines</summary>

``` kotlin
try {
val credentials = authentication
.tokenExchange("subject_token_type", "subject_token")
.await()
} catch (e: AuthenticationException) {
e.printStacktrace()
}
```
</details>

<details>
<summary>Using Java</summary>

```java
authentication
.customTokenExchange("subject_token_type", "subject_token")
.start(new Callback<Credentials, AuthenticationException>() {
@Override
public void onSuccess(@Nullable Credentials payload) {
// Handle success
}
@Override
public void onFailure(@NonNull AuthenticationException error) {
// Handle error
}
});
```


</details>


## Credentials Manager

Expand Down

0 comments on commit 1364458

Please sign in to comment.