CORS error when connecting Springboot app from React

I have created Okta Springboot, Okta React applications. Both of them work fine individually.

When I try to access an API from React app, I’m getting a CORS error.

Access to XMLHttpRequest at 'http://localhost:8080/api/messages' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Please note that I have enabled the CORS referring Enable CORS

This issue has already been posted in the forum and there is no solution given Previous Tikcket

Hi, @mnibras

Please try adding http://localhost:3000 to your trusted origins.