xref: /petsc/src/sys/webclient/tutorials/boxobtainrefreshtoken.c (revision 9371c9d470a9602b6d10a8bf50c9b2280a79e45a)
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   char access_token[512], refresh_token[512];
13 
14   PetscFunctionBeginUser;
15   PetscCall(PetscInitialize(&argc, &argv, NULL, NULL));
16   PetscCall(PetscBoxAuthorize(PETSC_COMM_WORLD, access_token, refresh_token, sizeof(access_token)));
17   PetscCall(PetscPrintf(PETSC_COMM_WORLD, "Your one time refresh token is %s\n", refresh_token));
18   PetscCall(PetscFinalize());
19   return 0;
20 }
21 
22 /*TEST
23 
24    build:
25      requires: ssl saws
26 
27    test:
28      TODO: determine how to run this test without going through the browser
29 
30 TEST*/
31