Google oauth 400 response: "Access-Control-Allow-Origin" header is missing on the requested resource

I am trying to make a request from client javascript to google oauth endpoint ( https://accounts.google.com/o/oauth2/v2/auth ) with a google calendar area. The thing is, I cannot use the google javascript client because I actually use webpack and I do not want to separately include the javascript script outside my .js package.

So instead I use axios ( https://github.com/mzabriskie/axios ) so that the HTTP GET passes the aforementioned marker endpoint. This is what my query looks like:

https://accounts.google.com/o/oauth2/v2/auth?response_type=token&client_id={client id here}&nonce=c8ef445540186351d9108ad64d7a5b65&scope=https:%2F%2Fwww.googleapis.com%2Fauth%2Fcalendar

I created nonce using the crypto-js library MD5 function. Here are the request headers:

Accept:application/json, text/plain, */*
Origin:http://localhost:8000
Referer:http://localhost:8000/admin
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36

, google, :

alt-svc:quic=":443"; ma=2592000; v="32,31,30,29,28,27,26,25"
alternate-protocol:443:quic
cache-control:no-cache, no-store, max-age=0, must-revalidate
content-encoding:gzip
content-type:text/html; charset=utf-8
date:Mon, 18 Apr 2016 07:16:21 GMT
expires:Fri, 01 Jan 1990 00:00:00 GMT
pragma:no-cache
server:GSE
status:400
x-content-type-options:nosniff
x-frame-options:SAMEORIGIN
x-xss-protection:1; mode=block

chrome devtools:

XMLHttpRequest cannot load https://accounts.google.com/o/oauth2/v2/auth?response_type=token&client_id={client id here}&scope=https:%2F%2Fwww.googleapis.com%2Fauth%2Fcalendar. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8000' is therefore not allowed access. The response had HTTP status code 400.

, Google http://localhost:8000 " Javascript Origins", Google Calendar api. , - uri, ( http://localhost:8000 http://localhost:8000/admin, , ). , , , , , .

, : http://localhost:8000 , ( javascript) auth?

+4

All Articles