XMLHttpRequest error when trying to google login

송지혁
1 min readJan 17, 2019

--

I tried to adapt google login service to my service. So i listened the tutorial of google auth login from youtube, ‘netninja’

However i got problem after i deployed. When i try to log in, a strange error occurs. looks like this

Access to XMLHttpRequest at ‘…..’ from origin ‘null’ 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.

I did not know why this happen to me. I listened the youtube tutorial again and again. I checked google login setup many times. Sadly, there was no reference of this problem in SOF.

I was used to request by ‘axios’. This was the problem. I asked this problem solution to my genius mentor after 2 days painful solving days. He gave notice that you should not use ‘axios’ request in google login. I should use anchor tag instead of axios.

XMLHttpRequest error came from my mistake. It was terrible mistake that thinking a tag and axios get request are the same. The tutorial used anchor tag. But i ignore it. That was terrible mistake.

--

--

Responses (2)