I have created google single sign on by following steps mentioned in https://developers.google.com/identity/sign-in/web/sign-in
The sign in works like a charm but when i try to integrate sign out as per the article in the link
i get the following javascript error in console
Uncaught TypeError: Cannot read property 'getAuthInstance' of undefined
And my signout function looks like
<script>
function signOut() {
var auth2 = gapi.auth2.getAuthInstance();
auth2.signOut().then(function () {
console.log('User signed out.');
});
}
</script>
and my sign in looks like
function onSignIn(googleUser) {
var profile = googleUser.getBasicProfile();
console.log('ID: ' + profile.getId());
console.log('Name: ' + profile.getName());
console.log('Image URL: ' + profile.getImageUrl());
console.log('Email: ' + profile.getEmail());
}