assets/Code examples/WebAppSDK/photoSharingWidget/js/example3.js
/**
       * Called when authorization server replies.
       *
       * @param {Object} authResult Authorization result.
       */
Called when authorization server replies.
@param {Object} authResult Authorization result.
Called when authorization server replies . @param { Object } authResult Authorization result .
function handleAuthResult(authResult) {
        var authButton = document.getElementById('authorizeButton');
        var filePicker = document.getElementById('filePicker');
        authButton.style.display = 'none';
        filePicker.style.display = 'none';
        if (authResult && !authResult.error) {
          filePicker.style.display = 'block';
          filePicker.onchange = uploadFile;
        } else {
          authButton.style.display = 'block';
          authButton.onclick = function() {
              gapi.auth.authorize(
                  {'client_id': CLIENT_ID, 'scope': SCOPES, 'immediate': false},
                  handleAuthResult);
          };
        }
      }
function handleAuthResult ( authResult ) { var authButton = document . getElementById ( 'authorizeButton' ) ; var filePicker = document . getElementById ( 'filePicker' ) ; authButton . style . display = 'none' ; filePicker . style . display = 'none' ; if ( authResult && ! authResult . error ) { filePicker . style . display = 'block' ; filePicker . onchange = uploadFile ; } else { authButton . style . display = 'block' ; authButton . onclick = function ( ) { gapi . auth . authorize ( { 'client_id' : CLIENT_ID , 'scope' : SCOPES , 'immediate' : false } , handleAuthResult ) ; } ; } }
Called when authorization server replies.
Called when authorization server replies .
// Access token has been successfully retrieved, requests can be sent to the API. // No access token could be retrieved, show the button to start the authorization flow.