# CORS error on Amplify signInWithRedirect flow

**URL:** <https://community.auth0.com/t/cors-error-on-amplify-signinwithredirect-flow/185465>\
**Category:** Get Help\
**Tags:** application, sso\
**Created:** [April 14, 2025, 6:56pm UTC](https://community.auth0.com/t/cors-error-on-amplify-signinwithredirect-flow/185465 "2025-04-14T18:56:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![drandt](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@drandt](https://community.auth0.com/u/drandt)\
**Post date:** [April 14, 2025, 6:56pm UTC](https://community.auth0.com/t/cors-error-on-amplify-signinwithredirect-flow/185465/1 "2025-04-14T18:56:03Z")

</div>

Hey, I’m using Auth0 with Cognito/Amplify. I configured Amplify with my Auth0 oauth tenant, and when triggering signInWithRedirect(), I can log in successfully with my Auth0 account. However, returning to the callback page I get a CORS error on ‘xxx.auth0DOTcom/oauth2/token’.

I added the origin site (which is a localhost address) on the Application allowed origins/cors input (also to allowed web origins, callback url etc).

What could be the issue?

---

<div class="post-metadata">

**Author:** ![nipo535darly](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nipo535darly/32/74275_2.png) [@nipo535darly](https://community.auth0.com/u/nipo535darly)\
**Post date:** [April 15, 2025, 4:18am UTC](https://community.auth0.com/t/cors-error-on-amplify-signinwithredirect-flow/185465/2 "2025-04-15T04:18:36Z")

</div>

Hello,  
The CORS error happens because your Amplify setup is likely trying to call token directly from the browser, which is blocked by CORS.

To fix this:

Use Cognito Hosted UI for the federated login flow, not Auth0 directly.

In your Amplify config, make sure oauth.domain points to Cognito’s domain (not Auth0’s), and use responseType: ‘code’.

This way, Cognito handles the token exchange server-side, avoiding CORS issues.

Hope thats helps.

Best Regard,  
Nipo

---

<div class="post-metadata">

**Author:** ![drandt](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@drandt](https://community.auth0.com/u/drandt)\
**Post date:** [April 15, 2025, 8:19am UTC](https://community.auth0.com/t/cors-error-on-amplify-signinwithredirect-flow/185465/3 "2025-04-15T08:19:54Z")

</div>

Thanks for the explanation!

---

<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:** [April 29, 2025, 8:20am UTC](https://community.auth0.com/t/cors-error-on-amplify-signinwithredirect-flow/185465/4 "2025-04-29T08:20:01Z")

</div>

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