Google OAuth 2.0 is working correctly on back-end, but when I tried it from front-end (react) it is showing some error
Error:
Access to XMLHttpRequest at <google oauth redirect uri> (redirected from 'backend uri') from origin 'frontend uri' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
- In back-end I tested it is working fine.
- Proxy is added in react package.json file.
- URI is added on Google OAuth authorization (in Google console).
This is my login handler button. And I have given the correct link.
Please refer CORS as I have given process.env.FRONTEND_URL
and FRONTEND_URL
in config.env
is localhost:4000
.