我有谷歌api的问题,我有这个js
(function() {
var po = document.createElement('script');
po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/client:plusone.js?';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(po, s);
})();
var myParams = {
'clientid' : 'asdasdsad',
'cookiepolicy' : 'none',
'callback' : 'loginCallback', //callback function
'approvalprompt':'auto',
'accesstype':'online',
'scope' : 'https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/plus.profile.emails.read'
};
function login()
{
gapi.auth.signIn(myParams);
}
function loginCallback(result)
{
if(result['status']['signed_in'])
{
console.log("signed");
} else {
console.log(result);
console.log("secondo if");
}
}
和html:
<a href="#" id="g-btn" ><img src="{{ app.request.getBaseURL }}images/google.png" id="iconsocial" alt="google+" onclick="login()"></a>
当我点击href时,在控制台中我看到API中的2个调用“immediate_failed”
为什么?
感谢先进,对不起我的英语