goth
goth copied to clipboard
has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Hi Master,
I faced a cors issue, investigate a lot but didn't find any solution, anyone can help?
- Backend Web Framework: Gin
- Provider: Google
- API: Get /auth?provider=google Get /auth/google/callback
- Frontend: react axios.get('/auth', { params: { provider: "google", } })
Error Message: Access to XMLHttpRequest at 'https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=xxxx&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fauth%2Fgoogle%2Fcallback&response_type=code&scope=email+profile&state=xxxx' (redirected from 'http://localhost:3000/auth?provider=google') from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.