diff --git a/EXAMPLES.md b/EXAMPLES.md index f28070558..7f77b403f 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -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) @@ -487,6 +488,57 @@ authentication ``` +### Custom Token Exchange + +```kotlin +authentication + .customTokenExchange("subject_token_type", "subject_token") + .start(object : Callback { + override fun onSuccess(result: Credentials) { + // Handle success + } + + override fun onFailure(exception: AuthenticationException) { + // Handle error + } + + }) +``` +
+ Using coroutines + +``` kotlin +try { + val credentials = authentication + .tokenExchange("subject_token_type", "subject_token") + .await() +} catch (e: AuthenticationException) { + e.printStacktrace() +} +``` +
+ +
+ Using Java + +```java +authentication + .customTokenExchange("subject_token_type", "subject_token") + .start(new Callback() { + @Override + public void onSuccess(@Nullable Credentials payload) { + // Handle success + } + @Override + public void onFailure(@NonNull AuthenticationException error) { + // Handle error + } + }); +``` + + +
+ ## Credentials Manager