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

Closed
luoxi001713 opened this issue Dec 9, 2022 · 3 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.

@samueltuyizere
Copy link

Hey @luoxi001713 , did you get this fixed?

@Udhayarajan
Copy link

Udhayarajan commented Sep 13, 2024

@samueltuyizere embbed the URL in anchor tag(<a/>) . Don't make REST call to the URL

@samueltuyizere
Copy link

Thanks @Udhayarajan , I will try that out.

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

4 participants