TypeError: gapi.auth2 undefined

Are signIn and signOut used on the same page? Div g-signin2 loads and inits gapi.auth2 so it should work as long as those are on the same page. In case signOut is on separate page, you should manually load and init gapi.auth2 library. Full example (you have to replace YOUR_CLIENT_ID with your actual client_id): <html> … Read more