javascript - Google login / Third party authentication provider -


i'm developing angularjs app google login 1 of it's features. i'm using link implement feature
https://blog.codecentric.de/en/2014/06/angularjs-google-sign-integration/. here script called when page loaded `

<script type="text/javascript">     (function () {         var p = document.createelement('script');         p.type = 'text/javascript';         p.async = true;         p.src = 'https://apis.google.com/js/platform.js?onload=onloadcallback';         var  s = document.getelementsbytagname('script')[0];         s.parentnode.insertbefore(p, s);     })(); </script> 

`

is right way , how can fetch data google , show data user , if happy press sign , signed. have app created google api service , tried many options no success far.

thanks in advice.

well has problem login in directly out being clicked might problem in future try

<script type="text/javascript">       (function() {        var po = document.createelement('script'); po.type = 'text/javascript'; po.async = true;        po.src = 'https://apis.google.com/js/client.js?onload=onloadcallback';        var s = document.getelementsbytagname('script')[0]; s.parentnode.insertbefore(po, s);      })(); </script> 

in view

function login()  {   var myparams = {     'clientid' : 'your_client_id.apps.googleusercontent.com', //you need set client id     'cookiepolicy' : 'single_host_origin',     'callback' : 'logincallback', //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); } 

convert codes angular .

please see question details


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -