Google login / Fetch data after successful login -


i have added google third party authentication web application. google login works fine , i'm logged in successful. want after login google fetch user data. here function responsible login. `

/*function runs google login feature*/         $scope.ongooglelogin  = function () {             var myparams = {                 'clientid' : '******.apps.googleusercontent.com', //client id                 'cookiepolicy' : 'single_host_origin',                 'callback' : function (result) {                     if(result['status']['signed_in']) {                         var request = gapi.client.plus.people.get(                             {                                 "userid": 'me'                             }                         );                         request.execute(function (resp) {                             $scope.$apply(function () {                                     $scope.username = resp.displayname;                                     $scope.email = resp.emails[0].value;                             })                         });                     }                 }, //callback function                 'approvalprompt':'force',                 'scope' : 'https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/plus.profile.emails.read'             };             gapi.auth.signin(myparams);             $scope.isgoogleloginworking = true;         }; 

`

i'm getting error on line.

var request = gapi.client.plus.people.get 

here error:

uncaught typeerror: cannot read property 'people' of undefined

update

`*/function runs google login feature*/         $scope.ongooglelogin  = function () {             var myparams = {                 'clientid' : '******.apps.googleusercontent.com', //client id                 'cookiepolicy' : 'single_host_origin',                 'callback' : function (result) {                     if (result['status']['signed_in']) {                        gapi.client.load('plus','v1', function () { //this solved problem                              var request = gapi.client.plus.people.get({                                 'userid': 'me',                             });                             request.execute(function (resp) {                                 $scope.$apply(function () {                                     var username = resp.displayname;                                     $scope.signupmodel.useremail = resp.emails[0].value;                                     $scope.isgoogleloginworking = true;                                     $scope.stringsplitter(username);                                     $scope.submitcreateduserssocial();                                 });                             });                         });                     }                 }, //callback function                 'approvalprompt':'force',                 'scope' : 'https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/plus.profile.emails.read'             };             gapi.auth.signin(myparams);             $scope.isgoogleloginworking = true;         };` 

Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -