Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. #487

Open
luoxi001713 opened this issue Dec 9, 2022 · 0 comments

Comments

@luoxi001713
Copy link

luoxi001713 commented Dec 9, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant