# CORS issue when calling my external API in Auth0 action-trigger

**URL:** <https://community.auth0.com/t/cors-issue-when-calling-my-external-api-in-auth0-action-trigger/149520>\
**Category:** Get Help\
**Tags:** apis, application\
**Created:** [October 10, 2024, 4:05am UTC](https://community.auth0.com/t/cors-issue-when-calling-my-external-api-in-auth0-action-trigger/149520 "2024-10-10T04:05:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![azhhng](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/azhhng/32/61334_2.png) [@azhhng](https://community.auth0.com/u/azhhng)\
**Post date:** [October 10, 2024, 4:05am UTC](https://community.auth0.com/t/cors-issue-when-calling-my-external-api-in-auth0-action-trigger/149520/1 "2024-10-10T04:05:06Z")

</div>

Ready to post? 🔍 First, try searching for your answer.  
I currently have a post-login trigger action so that if a user is logging in for the first time, it makes a call to my external Node/Express API so that I can add some user information to my database.

My problem is that my server won’t accept any calls coming from Auth0 and I believe I see some CORS errors, but I have whitelisted my Auth0 tenant domain in my CORS so I believe it should work. Any help would be appreciated!

This is what my action-trigger looks like right now.

 ![image](https://global.discourse-cdn.com/auth0/original/3X/b/d/bd3c6a6097616d4255b512bca69be5ce2b0f86cf.png)

---

<div class="post-metadata">

**Author:** ![yellowblockllp](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/yellowblockllp/32/50901_2.png) [@yellowblockllp](https://community.auth0.com/u/yellowblockllp)\
**Post date:** [October 10, 2024, 4:47am UTC](https://community.auth0.com/t/cors-issue-when-calling-my-external-api-in-auth0-action-trigger/149520/2 "2024-10-10T04:47:16Z")

</div>

Hi @azhhng

you need to add secrets in the post logins i.e to access your database and redeploy the post login and you need to express you db connection in your code for reference like below screen shot

 ![image](https://global.discourse-cdn.com/auth0/original/3X/f/a/fa7b6b0753084b18286a43e4e3fe9047f617c43a.png)

i hope this might help you

---

<div class="post-metadata">

**Author:** ![azhhng](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/azhhng/32/61334_2.png) [@azhhng](https://community.auth0.com/u/azhhng)\
**Post date:** [October 10, 2024, 1:37pm UTC](https://community.auth0.com/t/cors-issue-when-calling-my-external-api-in-auth0-action-trigger/149520/3 "2024-10-10T13:37:31Z")

</div>

Hey @yellowblockllp, thanks for the suggestion but I am trying to call an endpoint on my external API which will access my database for me so I don’t have to directly call the database in Auth0! The problem is accessing my API from the Auth0 action trigger isn’t working for me

---

<div class="post-metadata">

**Author:** ![azhhng](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/azhhng/32/61334_2.png) [@azhhng](https://community.auth0.com/u/azhhng)\
**Post date:** [October 10, 2024, 2:11pm UTC](https://community.auth0.com/t/cors-issue-when-calling-my-external-api-in-auth0-action-trigger/149520/4 "2024-10-10T14:11:11Z")

</div>

I figured out my issue, and now it’s working!

For my CORS configuration in my server, I was not letting requests pass that did not contain an origin, which I guess Auth0 sometimes doesn’t send an origin when making requests, which is why it was getting blocked.

---

<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:** [October 24, 2024, 2:11pm UTC](https://community.auth0.com/t/cors-issue-when-calling-my-external-api-in-auth0-action-trigger/149520/5 "2024-10-24T14:11:30Z")

</div>

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