Date: 2021-03-03T22:25:50+00:00

Actual source code: googleobtainrefreshtoken.c
petsc-3.14.5 2021-03-03
Report Typos and Errors

      2: /*
      3:      Obtains a refresh token that you can use in the future to access Google Drive from PETSc code

      5:      Guard the refresh token like a password.

      7:      You can run PETSc programs with -google_refresh_token XXXX where XXX is the refresh token to access your Google Drive

      9: */

     11: #include <petscsys.h>

     13: int main(int argc,char **argv)
     14: {
     16:   char           access_token[512],refresh_token[512];

     18:   PetscInitialize(&argc,&argv,NULL,NULL);if (ierr) return ierr;
     19:   PetscGoogleDriveAuthorize(PETSC_COMM_WORLD,access_token,refresh_token,sizeof(access_token));
     20:   PetscPrintf(PETSC_COMM_WORLD,"Your Refresh token is %s\n",refresh_token);
     21:   PetscFinalize();
     22:   return ierr;
     23: }

     25: /*TEST

     27:    build:
     28:      requires: ssl

     30:    test:
     31:      TODO: determine how to run this test without going through the browser

     33: TEST*/