1

I want to display a google login page as soon as i fire up my extension where the user will login to his google account.

I was able to display details of the currently logged in user by following instructions from chrome.identity User Authentication in a Chrome Extension

My background.js has the following code

chrome.identity.getAuthToken({
    interactive: true
}, function(token) {
    if (chrome.runtime.lastError) {
        alert(chrome.runtime.lastError.message);
        return;
    }
    var x = new XMLHttpRequest();
    x.open('GET', 'https://www.googleapis.com/userinfo/v2/me?alt=json&access_token=' + token);
    x.onload = function() {
        alert(x.response);
    };
    x.send();
});

However, I want to be able to login to my extension using a different google account than the one which is logged in currently to chrome. How do I do this?

Community
  • 1
  • 1
pd176
  • 821
  • 3
  • 10
  • 20
  • Please keep the language tag for syntax highlight reasons – Xan Jun 18 '15 at 09:19
  • Why not fetch? http://updates.html5rocks.com/2015/03/introduction-to-fetch, https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch – Daniel Herr Jun 18 '15 at 20:58

0 Answers0