0

I'm trying to use the google api to make a voting system for my school. The idea is the be able to have a set of computers where students will be able to login with their school account. Turns out I was able to make the button to log in, but after the first login, it will always log back to the first account. Is there any way to avoid Google from "saving" the account I use?

Hope I was clear enough. My English is a bit rusty.

Thanks in advance

EDIT: This is my code:

  function signOut() {
    var auth2 = gapi.auth2.getAuthInstance();
    auth2.disconnect().then(function () {
      console.log('User signed out.');
    });
  }

  var googleUser = {};
  var startApp = function() {
    gapi.load('auth2', function(){
      // Retrieve the singleton for the GoogleAuth library and set up the client.
      auth2 = gapi.auth2.init({
        client_id: 'MY-CLIENT-ID.apps.googleusercontent.com',
        cookiepolicy: 'single_host_origin',
        // Request scopes in addition to 'profile' and 'email'
        //scope: 'additional_scope'
      });
      attachSignin(document.getElementById('google-btn'));
    });
  };

  function attachSignin(element) {
    console.log(element.id);
    auth2.attachClickHandler(element, {},
        function(googleUser) {
          console.log( "Signed in: " + googleUser.getBasicProfile().getName() );
        }, function(error) {
          alert(JSON.stringify(error, undefined, 2));
        });
  }

0 Answers0