javascript - google+ api login not returning email -


i have implemented javascript based google+ login in application using following code:

var isgpinitialzed = false;

function render() {     gapi.signin.render('loginwithgoogle', {         'callback': 'onsignin',         'clientid': 'the client id',         'cookiepolicy': 'single_host_origin',         'requestvisibleactions': 'http://schema.org/addaction',         'scope': 'https://www.googleapis.com/auth/plus.login'     });     isgpinitialzed = true; }   //google  function onsignin(authresult) {     if (!isgpinitialzed) {         if (authresult['status']['signed_in']) { //get user info             gapi.client.load('oauth2', 'v2', function () {                 gapi.client.oauth2.userinfo.get().execute(function (response) {                     console.log(response.email);                     $.ajax({                         url: '/account/glogin',                         type: 'post',                         data: {                             email: response.email,                             name: response.name,                             profilepicture: response.picture                         },                         datatype: 'json',                         success: function (isuserloggedin) {                             if (isuserloggedin) {                                 window.location.reload();                             }                         }                     });                 });             });         }     }     else {         isgpinitialzed = false;     } }; 

it working fine until created new application account , replaced client id. on successful authentication, api not returning user email in response. have checked in google+ account settings apps , there not setting give acces email. can issue?

change scope

'scope': 'https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/userinfo.email', 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -