I'm currently making the integration between Google Calendar and my company's website. But I'd like the save the user's credential, so he just have to authenticate only one time. I build the following URL.
And calling the following snippet:
xhr = new XMLHttpRequest();
xhr.open('GET', url);
xhr.setRequestHeader('Access-Control-Allow-Origin', '*');
xhr.send();
And now. I'm stuck...
You cannot perform an OAuth call via an
XMLHttpRequest
. If the user wasn't currently logged into Google how would the user log in via that call? How would the user approve your application's requested permissions? You must actually redirect their browser to that URL.