# \[Actions\]\[AccountLinking\] How to do Account Linking from a PostLogin Action?

**URL:** <https://community.auth0.com/t/actions-accountlinking-how-to-do-account-linking-from-a-postlogin-action/63840>\
**Category:** Get Help\
**Tags:** actions, management-api, login\
**Created:** [June 3, 2021, 6:03pm UTC](https://community.auth0.com/t/actions-accountlinking-how-to-do-account-linking-from-a-postlogin-action/63840 "2021-06-03T18:03:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![eric.van](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/eric.van/32/29781_2.png) [@eric.van](https://community.auth0.com/u/eric.van)\
**Post date:** [June 3, 2021, 6:03pm UTC](https://community.auth0.com/t/actions-accountlinking-how-to-do-account-linking-from-a-postlogin-action/63840/1 "2021-06-03T18:03:32Z")

</div>

Hi! Hope your are doing well!!

**TL;DR:** Is currently a way to get access to the ManagementAPI to do account linking from Actions?

**Long explanation:**  
I have been trying to do seamlessly account linking of previously created Database users with Google OAuth2 users with the new Actions feature, I understand that this should be done using de ManagementAPI that is available from the “auth0” npm package.

For this I require some credentials that were previously available from the context object ([here](https://community.auth0.com/t/using-the-management-api-in-flow-actions/60689)) which is no longer available after the **Actions GA Programming Model** update.

Is currently a way to get access to the ManagementAPI to do account linking from Actions?

* * *

**Solution Explanation:**  
Also, I was really confused, because the context parameter has been removed from the actions functions signature as stated [here](https://auth0.com/docs/actions/programming-model-changes).

Secrets were moved from:

```auto
async function myFunction(event, context) {
    console.log(context.secrets);
}

```

to:

```auto
exports.onExecutePostLogin = async (event, api) => {
  console.log(event.secrets);
}

```

**Finally** , I did not realize that ManagementAPI can be used with

```auto
var auth0 = new ManagementClient({
  domain: '{YOUR_ACCOUNT}.auth0.com',
  clientId: '{YOUR_NON_INTERACTIVE_CLIENT_ID}',
  clientSecret: '{YOUR_NON_INTERACTIVE_CLIENT_SECRET}',
  scope: 'read:users update:users'
});

```

---

<div class="post-metadata">

**Author:** ![alexab](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/alexab/32/13403_2.png) [@alexab](https://community.auth0.com/u/alexab)\
**Post date:** [June 3, 2021, 6:16pm UTC](https://community.auth0.com/t/actions-accountlinking-how-to-do-account-linking-from-a-postlogin-action/63840/2 "2021-06-03T18:16:07Z")

</div>

The credentials in the above example er simply “secrets”, and nothing “special” .

---

<div class="post-metadata">

**Author:** ![eric.van](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/eric.van/32/29781_2.png) [@eric.van](https://community.auth0.com/u/eric.van)\
**Post date:** [June 3, 2021, 7:58pm UTC](https://community.auth0.com/t/actions-accountlinking-how-to-do-account-linking-from-a-postlogin-action/63840/3 "2021-06-03T19:58:56Z")

</div>

Oh, ok, I see now! I was looking for some kind of accessToken, my bad. Thanks!

Also, I was really confused, because the context parameter has been removed from the actions functions signature as stated [here](https://auth0.com/docs/actions/programming-model-changes).

Secrets were moved from:

```auto
async function myFunction(event, context) {
    console.log(context.secrets);
}

```

to:

```auto
exports.onExecutePostLogin = async (event, api) => {
  console.log(event.secrets);
}

```

---

<div class="post-metadata">

**Author:** ![alexab](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/alexab/32/13403_2.png) [@alexab](https://community.auth0.com/u/alexab)\
**Post date:** [June 3, 2021, 8:05pm UTC](https://community.auth0.com/t/actions-accountlinking-how-to-do-account-linking-from-a-postlogin-action/63840/4 "2021-06-03T20:05:17Z")

</div>

No worries. I spent quite some time on the Auth0 platform - you can always reach out if you have any questions 😌

---

<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:** [June 18, 2021, 8:05pm UTC](https://community.auth0.com/t/actions-accountlinking-how-to-do-account-linking-from-a-postlogin-action/63840/5 "2021-06-18T20:05:41Z")

</div>

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