When I call gapi.auth.signIn it is called twice: before opening login popup and after user clicks login button. But in both cases authResponse parameter is not changed.
Here is my code sample:
gapi.auth.signIn({
scope: 'https://www.googleapis.com/auth/plus.login',
callback: function(authResponse) {
console.log(authResponse);
}
)};
And this is how authResponse object looks like in both cases
{
client_id: /* my client id */
cookie_policy: undefined
error: "immediate_failed"
error_subtype: "access_denied"
expires_at: "1422353634"
expires_in: "86400"
g_user_cookie_policy: undefined
issued_at: "1422267234"
response_type: "token"
scope: "https://www.googleapis.com/auth/plus.login"
state: ""
status:
{
google_logged_in: false
method: null
signed_in: false
}
}
EDIT: Before sign in I try to check if user is already authorized in google, here is this code:
gapi.auth.authorize({
client_id: _googleClientId,
immediate: true,
scope: 'https://www.googleapis.com/auth/plus.login'
}, function(response) {
if (response.status.signed_in) {
connectGoogleSuccess(response);
} else {
gapi.auth.signIn({
scope: 'https://www.googleapis.com/auth/plus.login',
callback: function(authResponse) {
console.log(authResponse);
}
)};
}
}
);
How to make to change authResponse object properly after user clicked 'Login' button?
Any help is appreciated)