Closed sescotti closed 8 months ago
hey @sescotti . Sorry for any inconvenience while using the library. Based on the code base, seems that you are trying to use a custom endpoint ? Custom endpoints need to be configured on the userpool console. However if you are not using custom endpoints, you only need to provide your userPoolId
and userPoolClientId
to make requests using the Auth APIs.
hi @israx thanks for the response. I was trying to use the Cognito domain that I generated in the console (screenshot below)
I was just testing out the amplify-cognito integration with the bare minimum, although at some point the idea is to start using a custom domain. will I have the same problem in that case? is there any way to circumvent this?
thanks!
Hey there, @sescotti 👋. Like @israx stated above, this looks like it could be tied to the userPoolEndpoint that you're setting as the Cognito Hosted UI URL . The default userPoolEndpoint might be getting overwritten, so can you possibly try just commenting out/removing line #14 in your App.tsx
(within the Amplify.configure
call). This shouldn't give you any issues when moving to your custom domain, but you may need to specify other properties within the Cognito
object if you're doing a scoped Auth config. Check out this link to the docs for an example.
Were you able to resolve the issue with CORS errors though?
hi @cwomack ok so this is my bad...these domains are ONLY to be used with HostedUI/OAuth, so I don't need to configure them.
After removing the userPoolEndpoint
property and it worked perfectly, no CORS error in sight.
thanks a lot to both.
@sescotti glad you were able to get this resolved, I'll mark this issue as resolved.
Before opening, please confirm:
JavaScript Framework
React
Amplify APIs
Authentication
Amplify Categories
auth
Environment information
Describe the bug
Hi, I'm using aws-amplify v6 to use AWS Cognito as my auth strategy. I'm facing CORS issues while trying to use the basic functions from the library. Tried to debug the process to see if there was any way of bypassing this but couldn't find anything.
Getting this error
Not sure if the same happens with a custom domain (although after examining the library code, I think it will happen too)
Expected behavior
The library sets the right conditions to avoid hitting a CORS error.
Reproduction steps
1- Clone the following repo https://github.com/sescotti/amplify-cors (Optional: open repo in devcontainers) 2- Install dependencies. 3- Replace the values in App.tsx (lines 6 to 8) 4- Run
npm run start
and navigate tolocalhost:3000
5- Fill the form and click Submit.Code Snippet
Log output
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response