-1
rated 0 times
[
0]
[
1]
/ answers: 1 / hits: 18550
/ 9 Years ago, wed, june 10, 2015, 12:00:00
I want to provide users a facility to sign in with google. However, I want to use my image(only image, no css) as sign in with google button. I am using the following code:
<div id=mySignin><img src=images/google.png alt=google/></div>
I am also using gapi.signin.render function as mentioned on google developer console. The code is:
<script src=https://apis.google.com/js/client:platform.js type=text/javascript></script>
<script>
function render(){
gapi.signin.render(mySignIn, {
// 'callback': 'signinCallback',
'clientid': 'xxxx.apps.googleusercontent.com',
'cookiepolicy': 'single_host_origin',
'requestvisibleactions': 'http://schema.org/AddAction',
'scope': 'profile'
});
}
The problem is that google signin popup is not opening and I cannot figure out how to solve it. Please suggest. Thanks in advance.
<script type=text/JavaScript>
/**
* Handler for the signin callback triggered after the user selects an account.
*/
function onSignInCallback(resp) {
gapi.client.load('plus', 'v1', apiClientLoaded);
}
/**
* Sets up an API call after the Google API client loads.
*/
function apiClientLoaded() {
gapi.client.plus.people.get({userId: 'me'}).execute(handleEmailResponse);
}
/**
* Response callback for when the API client receives a response.
*
* @param resp The API response object with the user email and profile information.
*/
function handleEmailResponse(resp) {
var primaryEmail;
var jsonobj=JSON.stringify(resp);alert(jsonobj);
var uid= jsonobj.id;
var user_name1= jsonobj.name;
for (var i=0; i < resp.emails.length; i++) {
if (resp.emails[i].type === 'account') primaryEmail = resp.emails[i].value;
}
/* document.getElementById('response').innerHTML = 'Primary email: ' +
primaryEmail + '<br/>id is: ' + uid; */
}
More From » google-api