#g4g_refreshToken()

      *//////////////////////////////////////////////////////////////*
      * #g4g_refreshToken - Refresh Token                            *
      *                                                              *
      * Output:                                                      *
      *   Out_errMsg - The error message (if error exists).          *
      *   Out_newToken - The new OAuth 2.0 token.                    *
      *                                                              *
      * Returns:                                                     *
      *   -1 for error, 0 for success                                *
      *                                                              *
      * Input Variables ([r]=required)                               *
      *   In_id - Google ID [r]                                      *
      *   In_service - Service Name [r]                              *
      *   In_ccsid - The CCSID to use (1208)                         *
      *   In_debug - Turn on Debug (*NO, *YES)                       *
      *   In_debug_file - The debug file name.                       *
      *                                                              *
      *//////////////////////////////////////////////////////////////*
     D #g4g_refreshToken...                                             
     D                 PR            10i 0                              
     D   In_id                      256    Value                        
     D   In_service                  64    Value                        
     D   Out_newToken               256                                 
     D   Out_errorMsg               256                                 
     D   In_ccsid                     7  0 Value Options(*NOPASS)       
     D   In_debug                     4    Value Options(*NOPASS)       
     D   In_debugFile               256    Value Options(*NOPASS)       

#g4g_refreshToken will attempt to refresh the token for an account/service. If a refresh is not needed (within 60 seconds of the token expiration) the original token will be returned.

Returns: 0 for successful creation, -1 for error.

Input Parameters:

  • In_id - The Google ID to refresh to the token for. (required)
  • In_service - The service (as set up in the G4GSVCPF file) to refresh the token for. (required)
  • In_ccsid - The CCSID to use. Defaults to 1208.
  • In_debug - Turn debug on (*YES) or off (*NO). Default is *NO.
  • In_debugFile - The name of the debug file to use. If not specified, the default of /tmp/g4g_refreshToken.<id>.refreshToken will be used where <id> is a unique ID generated by G4G.

Output Parameters:

  • Out_newToken - The new token, if required. Otherwise the current token will be returned.
  • Out_errorMsg - An error message if an error was encountered.