# Error while linking account

**URL:** <https://community.auth0.com/t/error-while-linking-account/64990>\
**Category:** Get Help\
**Tags:** auth0\
**Created:** [June 24, 2021, 2:25pm UTC](https://community.auth0.com/t/error-while-linking-account/64990 "2021-06-24T14:25:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![goshatravin](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/goshatravin/32/30198_2.png) [@goshatravin](https://community.auth0.com/u/goshatravin)\
**Post date:** [June 24, 2021, 2:25pm UTC](https://community.auth0.com/t/error-while-linking-account/64990/1 "2021-06-24T14:25:11Z")

</div>

When i try to link 2 users account i got an error  
`data: { statusCode: 400, error: 'Bad Request', message: 'Invalid token (link_with).', errorCode: 'invalid_body' }`

this is option for this call

```auto
let options = {
            method: 'POST',
            url: `${config.auth0.api}users/${currentUser}/identities`,
            headers: {
                authorization: 'Bearer ' + token,
                'content-type': 'application/json'
            },
            data: {
                link_with: subTargetUser
            },
            responseType: 'json'
        };

```

token = AccessTokens  
currentUser = google-oauth2|XXXXXXXXXXXXXXXX  
targetUser = auth0|XXXXXXXXXXXXXX

what i am doing wrong ?

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [June 28, 2021, 9:57pm UTC](https://community.auth0.com/t/error-while-linking-account/64990/3 "2021-06-28T21:57:51Z")

</div>

Hi @goshatravin,

Welcome to the Community!

You are combining the two different ways of invoking this endpoint.

Take a look at the documentation and choose one of the two strategies:

> **[Auth0 Management API v2](https://auth0.com/docs/api/management/v2#!/Users/post_identities)**

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [July 13, 2021, 9:57pm UTC](https://community.auth0.com/t/error-while-linking-account/64990/4 "2021-07-13T21:57:55Z")

</div>

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