I am using Google Plus as login, which worked fine until recently. Now the user can't log out anymore. The callback works and returns that the user is signed out, however after that it immediately signs the user in again. Seems like it is not storing the logout.
There's a few older questions on this like for example this one. I tried all the proposed solutions but nothing worked.
Code in the html head
<script src="https://apis.google.com/js/client:platform.js?onload=start" async defer></script>
Button code, which is always displayed (hidden when logged in)
<div id="signinButton">
<span class="g-signin"
data-scope="https://www.googleapis.com/auth/gmail.readonly"
data-clientid="{{ CLIENT_ID }}"
data-redirecturi="postmessage"
data-accesstype="offline"
data-cookiepolicy="single_host_origin"
data-callback="signInCallback">
</span>
</div>
SignIn and SignOut function
<script>
function signInCallback(authResult) {
//console.log(authResult)
if (authResult['code']) {
var state = encodeURIComponent('{{ STATE }}');
var code = encodeURIComponent(authResult['code']);
var tz = encodeURIComponent($('#timezone').val());
var cntry = encodeURIComponent($('#country').val());
var lan = encodeURIComponent('{{ language }}');
// Send the code to the server
$.ajax({
type: 'POST',
url: '/signup/gauth',
contentType: 'application/octet-stream; charset=utf-8',
success: function(result) {
console.log(result)
if (result == 'Success') {
{% if not user %}window.location = "/user/home";{% else %}
console.log('Logged in');{% endif %}
}
},
processData: false,
data: 'code='+code+'&state='+state+'&country='+cntry+'&tz='+tz+'&language='+lan
});
}
else if (authResult['error']) {
console.log('Sign-in state: ' + authResult['error']);
}
}
function signOut() {
gapi.auth.signOut();
window.location = "/user/logout"
}
</script>