# Can I connect to a database in the Post-login Flows actions script?

**URL:** <https://community.auth0.com/t/can-i-connect-to-a-database-in-the-post-login-flows-actions-script/109811>\
**Category:** Get Help\
**Tags:** identifier-first, login-experience\
**Created:** [June 22, 2023, 7:54pm UTC](https://community.auth0.com/t/can-i-connect-to-a-database-in-the-post-login-flows-actions-script/109811 "2023-06-22T19:54:03Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [June 22, 2023, 9:34pm UTC](https://community.auth0.com/t/can-i-connect-to-a-database-in-the-post-login-flows-actions-script/109811/3 "2023-06-22T21:34:21Z")

</div>

Hello @jared.modugno welcome to the community!

> [@jared.modugno](#):
>
> The metadata “data” is on my database, is there a way I can utilize the Post-login script, connect to my sql database, and add the metadata?

You can definitely connect to your own API/database from within a post-login action - You will need to write the necessary action code (Hopefully a npm package available for your DB) that connects to your database and performs the desired operations. The following thread may be of use as well:

> [@How do I call my API from an Action?](https://community.auth0.com/t/how-do-i-call-my-api-from-an-action/69041):
>
> Hey, So I’m in the process of trying to add a user to my database using an API call from a “Post User Registration” Action. I have followed this blog post here: and seem to have everything looking good. On top of that when I run the test it says the action was successful. The only problem is that my API is not being called at all even though I have triple checked that the URL is correct. Here is the code I’m working with: import axios from "axios"; exports.onExecutePostUserRegistration = …

Hope this helps!

---

_[View the full topic](https://community.auth0.com/t/can-i-connect-to-a-database-in-the-post-login-flows-actions-script/109811)._
