@@ -2878,232 +2878,6 @@ params.put("screen_hint", "signup");
28782878```
28792879</details >
28802880
2881- ## Management API
2882-
2883- The client provides a few methods to interact with the [ Users Management API] ( https://auth0.com/docs/api/management/v2/#!/Users ) .
2884-
2885- Create a new instance passing the account and an access token with the Management API audience and the right scope:
2886-
2887- ``` kotlin
2888- val users = UsersAPIClient (account, " api access token" )
2889- ```
2890-
2891- <details >
2892- <summary >Using Java</summary >
2893-
2894- ``` java
2895- Auth0 account = Auth0 . getInstance(" client id" , " domain" );
2896- UsersAPIClient users = new UsersAPIClient (account, " api token" );
2897- ```
2898- </details >
2899-
2900- ### Link users
2901-
2902- ``` kotlin
2903- users
2904- .link(" primary user id" , " secondary user token" )
2905- .start(object : Callback <List <UserIdentity >, ManagementException > {
2906-
2907- override fun onFailure (exception : ManagementException ) { }
2908-
2909- override fun onSuccess (identities : List <UserIdentity >) { }
2910- })
2911- ```
2912-
2913- <details >
2914- <summary >Using coroutines</summary >
2915-
2916- ``` kotlin
2917- try {
2918- val identities = users
2919- .link(" primary user id" , " secondary user token" )
2920- .await()
2921- println (identities)
2922- } catch (e: ManagementException ) {
2923- e.printStacktrace()
2924- }
2925- ```
2926- </details >
2927-
2928- <details >
2929- <summary >Using Java</summary >
2930-
2931- ``` java
2932- users
2933- .link(" primary user id" , " secondary user token" )
2934- .start(new Callback<List<UserIdentity > , ManagementException > () {
2935- @Override
2936- public void onSuccess (List<UserIdentity > payload ) {
2937- // Got the updated identities! Accounts linked.
2938- }
2939-
2940- @Override
2941- public void onFailure (@NonNull ManagementException error ) {
2942- // Error!
2943- }
2944- });
2945- ```
2946- </details >
2947-
2948- ### Unlink users
2949-
2950- ``` kotlin
2951- users
2952- .unlink(" primary user id" , " secondary user id" , " secondary provider" )
2953- .start(object : Callback <List <UserIdentity >, ManagementException > {
2954-
2955- override fun onFailure (exception : ManagementException ) { }
2956-
2957- override fun onSuccess (identities : List <UserIdentity >) { }
2958- })
2959- ```
2960-
2961- <details >
2962- <summary >Using coroutines</summary >
2963-
2964- ``` kotlin
2965- try {
2966- val identities = users
2967- .unlink(" primary user id" , " secondary user id" , " secondary provider" )
2968- .await()
2969- println (identities)
2970- } catch (e: ManagementException ) {
2971- e.printStacktrace()
2972- }
2973- ```
2974- </details >
2975-
2976- <details >
2977- <summary >Using Java</summary >
2978-
2979- ``` java
2980- users
2981- .unlink(" primary user id" , " secondary user id" , " secondary provider" )
2982- .start(new Callback<List<UserIdentity > , ManagementException > () {
2983- @Override
2984- public void onSuccess (List<UserIdentity > payload ) {
2985- // Got the updated identities! Accounts linked.
2986- }
2987-
2988- @Override
2989- public void onFailure (@NonNull ManagementException error ) {
2990- // Error!
2991- }
2992- });
2993- ```
2994- </details >
2995-
2996- ### Get User Profile
2997-
2998- ``` kotlin
2999- users
3000- .getProfile(" user id" )
3001- .start(object : Callback <UserProfile , ManagementException > {
3002-
3003- override fun onFailure (exception : ManagementException ) { }
3004-
3005- override fun onSuccess (identities : UserProfile ) { }
3006- })
3007- ```
3008-
3009- <details >
3010- <summary >Using coroutines</summary >
3011-
3012- ``` kotlin
3013- try {
3014- val user = users
3015- .getProfile(" user id" )
3016- .await()
3017- println (user)
3018- } catch (e: ManagementException ) {
3019- e.printStacktrace()
3020- }
3021- ```
3022- </details >
3023-
3024- <details >
3025- <summary >Using Java</summary >
3026-
3027- ``` java
3028- users
3029- .getProfile(" user id" )
3030- .start(new Callback<UserProfile , ManagementException > () {
3031- @Override
3032- public void onSuccess (@Nullable UserProfile payload ) {
3033- // Profile received
3034- }
3035-
3036- @Override
3037- public void onFailure (@NonNull ManagementException error ) {
3038- // Error!
3039- }
3040- });
3041- ```
3042- </details >
3043-
3044- ### Update User Metadata
3045-
3046- ``` kotlin
3047- val metadata = mapOf (
3048- " name" to listOf (" My" , " Name" , " Is" ),
3049- " phoneNumber" to " 1234567890"
3050- )
3051-
3052- users
3053- .updateMetadata(" user id" , metadata)
3054- .start(object : Callback <UserProfile , ManagementException > {
3055-
3056- override fun onFailure (exception : ManagementException ) { }
3057-
3058- override fun onSuccess (identities : UserProfile ) { }
3059- })
3060- ```
3061-
3062- <details >
3063- <summary >Using coroutines</summary >
3064-
3065- ``` kotlin
3066- val metadata = mapOf (
3067- " name" to listOf (" My" , " Name" , " Is" ),
3068- " phoneNumber" to " 1234567890"
3069- )
3070-
3071- try {
3072- val user = users
3073- .updateMetadata(" user id" , metadata)
3074- .await()
3075- println (user)
3076- } catch (e: ManagementException ) {
3077- e.printStacktrace()
3078- }
3079- ```
3080- </details >
3081-
3082- <details >
3083- <summary >Using Java</summary >
3084-
3085- ``` java
3086- Map<String , Object > metadata = new HashMap<> ();
3087- metadata. put(" name" , Arrays . asList(" My" , " Name" , " Is" ));
3088- metadata. put(" phoneNumber" , " 1234567890" );
3089-
3090- users
3091- .updateMetadata(" user id" , metadata)
3092- .start(new Callback<UserProfile , ManagementException > () {
3093- @Override
3094- public void onSuccess (@Nullable UserProfile payload ) {
3095- // User Metadata updated
3096- }
3097-
3098- @Override
3099- public void onFailure (@NonNull ManagementException error ) {
3100- // Error!
3101- }
3102- });
3103- ```
3104- </details >
3105-
3106- > In all the cases, the ` user ID ` parameter is the unique identifier of the auth0 account instance. i.e. in ` google-oauth2|123456789 ` it would be the part after the '|' pipe: ` 123456789 ` .
31072881
31082882## Token Validation
31092883The ID token received as part of the authentication flow is should be verified following the [ OpenID Connect specification] ( https://openid.net/specs/openid-connect-core-1_0.html ) .
0 commit comments