Path Validation Error When Trying to Link Accounts Via Management API

Hello, I am trying to link accounts via the management api using the auth0.js library. I am using the following code.

  linkAccounts(authResult) {
    return new Promise((resolve) => {
      const auth0Manage = new auth0.Management({
        domain: 'demandhive.auth0.com',
        token: this.getAccessToken(),
      });
      const secondaryUserToken = authResult.idToken;
      auth0Manage.linkUser(this.getIdToken(),secondaryUserToken, (err,response,body) => { 
        console.log(err,response,body)
        resolve() 
      });
    })
  }

However, when I make the call, I am receiving a status 400: bad request.

The error I get is:

"Path validation error: 'Object didn't pass validation for format user-id: <sent_token>...
on property id (The user_id of the primary identity where you are linking the secondary account to).

Hello @average_user,

Not an expert with auth0.js, but I believe that first parameter to auth0Manage.linkUser should be the user_id (e.g., auth0|abc123) of the primary identity, not an idToken.

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.