If you want to subscribe the user to auth2.signOut() on the server side, check this code (although this is python, you should get an idea).
app.signOut = function() { // Get `GoogleAuth` instance var auth2 = gapi.auth2.getAuthInstance(); // Sign-Out fetch('/signout', { method: 'POST', credentials: 'include' }).then(function(resp) { if (resp.status === 200) { auth2.signOut() .then(changeProfile); } else { console.error("couldn't sign out"); } }).catch(function(error) { console.error(error); }); };
And this one
@app.route('/signout', methods=['POST']) def signout():
It depends on how you structure the sessions, but you can send an ajax request to the server before signOut() .
source share