Ignore:
Timestamp:
2021-09-04T16:25:30+12:00 (3 years ago)
Author:
davidb
Message:

Further refinement of the Google Signin process from the JS/Web Browser side of things

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/web/interfaces/default/transform/layouts/header.xsl

    r35322 r35331  
    9797    function gslogout(logout_action_url) {
    9898      if (googlesignin_client_id != '') {
    99         googleSignout();
     99        googleLogout();
    100100      }
    101101      window.location = logout_action_url;
     
    187187    function googleSigninInit() {
    188188      gapi.load('auth2', function() {
    189         auth2 = gapi.auth2.init({
     189        var auth2 = gapi.auth2.init({
    190190           client_id: googlesignin_client_id,
    191191           //scope: 'email' // don't need to top up 'profile' with 'email' as not used client side (email is retrieved via GS3 Servlet)
    192         });
     192         })
     193         .then(function() {     
     194           if (typeof optGoogleAuth2InitCallback === "function"){
     195             optGoogleAuth2InitCallback();
     196           }
     197         });
    193198      });
    194199    }
    195200         
    196     function googleSignout() {
     201    function googleLogout() {
    197202      var auth2 = gapi.auth2.getAuthInstance();
    198       auth2.signOut().then(function () {
     203      // Use 'disconnect()' rather than 'signOut()' as this does a deeper logout
     204      // that revokes the user's "Google granted" permission.
     205      // This makes it easier, when using the same browser, to login into Greenstone3
     206      // using a differeng Google sign-in account
     207
     208      auth2.disconnect().then(function () {
    199209        console.log("Google-authenticated User signed out");
    200210      });
Note: See TracChangeset for help on using the changeset viewer.