Heading
I'm working on Google App Engine. Using Python with the webbapp2 framework.
I use Google API to login e logout. It seems to work well. Login and logout are perfect. This is the Google official guide: https://developers.google.com/+/web/signin/
The problem is that just after being logged out refreshing the page the user will automatically logged-in again.
This is Login Button with relative parameters:
<span
class="g-signin"
data-callback="signinCallback"
data-clientid="##################.apps.googleusercontent.com"
data-cookiepolicy="single_host_origin"
data-requestvisibleactions="http://schemas.google.com/AddActivity"
data-scope="https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/userinfo.email">
<button type="button">GOOGLE+ LOGIN</button>
</span>
This is Logout Button:
<button onclick="disconnectUser()">Disconnect</button>
This is the Logout callback function:
<script type="text/javascript">
function disconnectUser(access_token) {
var revokeUrl = 'https://accounts.google.com/o/oauth2/revoke?token=' +
access_token;
// Esecuzione di una richiesta GET asincrona.
$.ajax({
type: 'GET',
url: revokeUrl,
async: false,
contentType: "application/json",
dataType: 'jsonp',
success: function(nullResponse) {
// Esegui un'azione, l'utente è disconnesso
// La risposta è sempre indefinita.
document.getElementById('signinButton').setAttribute('style', 'display: inherit');
document.getElementById('revokeButton').setAttribute('style', 'display: none');
},
error: function(e) {
// Gestione dell'errore
// console.log(e);
// Puoi indirizzare gli utenti alla disconnessione manuale in caso di esito negativo
// https://plus.google.com/apps
}
});
}
// È possibile attivare la disconnessione con un clic del pulsante
$('#revokeButton').click(disconnectUser);
</script>
What do you think? What could be the problem? Something concerning cookies setting?