简体   繁体   中英

How do I log In with GMAIL and get user info (Javascript)?

I'm having some trouble getting gmail login to work. In fact, the log in process is already working, but I don't know how to get the user's data (username, email, birthday...). I see there are a lot of APIs to get the calendar, mails, contacts... BUT NOT THE INFO... I managed to get the contacts (following a tutorial), just expecting to get the data from the response, but it was not there. The code I have:


<script type="text/javascript" src="http://www.google.com/jsapi"></script>

<script type="text/javascript">
google.load("gdata", "1.x");

function setupContactsService() {
    contactsService = new google.gdata.contacts.ContactsService('exampleCo-exampleApp-1.0');
}

function logMeIn() {
    var scope = 'https://www.google.com/m8/feeds';
    var token = google.accounts.user.login(scope);
}

function btn_login() {
    setupContactsService();
    logMeIn();
}
</script>

And there is a button that calls btn_login().

I hope you can help me! Thanks!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM