File tree Expand file tree Collapse file tree 1 file changed +52
-0
lines changed
Expand file tree Collapse file tree 1 file changed +52
-0
lines changed Original file line number Diff line number Diff line change 1717 - [ Step 2: Input the code] ( #step-2-input-the-code )
1818 - [ Sign Up with a database connection] ( #sign-up-with-a-database-connection )
1919 - [ Get user information] ( #get-user-information )
20+ - [ Custom Token Exchange] ( #custom-token-exchange )
2021 - [ Credentials Manager] ( #credentials-manager )
2122 - [ Secure Credentials Manager] ( #secure-credentials-manager )
2223 - [ Usage] ( #usage )
@@ -487,6 +488,57 @@ authentication
487488```
488489</details >
489490
491+ ### Custom Token Exchange
492+
493+ ``` kotlin
494+ authentication
495+ .customTokenExchange(" subject_token_type" , " subject_token" )
496+ .start(object : Callback <Credentials , AuthenticationException > {
497+ override fun onSuccess (result : Credentials ) {
498+ // Handle success
499+ }
500+
501+ override fun onFailure (exception : AuthenticationException ) {
502+ // Handle error
503+ }
504+
505+ })
506+ ```
507+ <details >
508+ <summary>Using coroutines</summary>
509+
510+ ``` kotlin
511+ try {
512+ val credentials = authentication
513+ .tokenExchange(" subject_token_type" , " subject_token" )
514+ .await()
515+ } catch (e: AuthenticationException ) {
516+ e.printStacktrace()
517+ }
518+ ```
519+ </details >
520+
521+ <details >
522+ <summary >Using Java</summary >
523+
524+ ``` java
525+ authentication
526+ .customTokenExchange(" subject_token_type" , " subject_token" )
527+ .start(new Callback<Credentials , AuthenticationException > () {
528+ @Override
529+ public void onSuccess (@Nullable Credentials payload ) {
530+ // Handle success
531+ }
532+ @Override
533+ public void onFailure (@NonNull AuthenticationException error ) {
534+ // Handle error
535+ }
536+ });
537+ ```
538+
539+
540+ </details >
541+
490542
491543## Credentials Manager
492544
You can’t perform that action at this time.
0 commit comments