xref: /petsc/src/sys/webclient/tutorials/boxobtainrefreshtoken.c (revision d5b43468fb8780a8feea140ccd6fa3e6a50411cc)
1 
2 /*
3      Obtains a refresh token that you can use in the future to access Box from PETSc code
4 
5      You can run PETSc programs with -box_refresh_token XXXX where XXX is the refresh token to access your Box
6 
7 */
8 
9 #include <petscsys.h>
10 
11 int main(int argc, char **argv)
12 {
13   char access_token[512], refresh_token[512];
14 
15   PetscFunctionBeginUser;
16   PetscCall(PetscInitialize(&argc, &argv, NULL, NULL));
17   PetscCall(PetscBoxAuthorize(PETSC_COMM_WORLD, access_token, refresh_token, sizeof(access_token)));
18   PetscCall(PetscPrintf(PETSC_COMM_WORLD, "Your one time refresh token is %s\n", refresh_token));
19   PetscCall(PetscFinalize());
20   return 0;
21 }
22 
23 /*TEST
24 
25    build:
26      requires: ssl saws
27 
28    test:
29      TODO: determine how to run this test without going through the browser
30 
31 TEST*/
32