# PetscBoxAuthorize
Get authorization and refresh token for accessing Box drive from PETSc 
## Synopsis
```
PetscErrorCode PetscBoxAuthorize(MPI_Comm comm, char access_token[], char refresh_token[], size_t tokensize)
```
Not collective, only the first rank in `MPI_Comm` does anything


## Input Parameters

- ***comm -*** the MPI communicator
- ***tokensize -*** size of the token arrays



## Output Parameters

- ***access_token -*** can be used with `PetscBoxUpload()` for this one session
- ***refresh_token -*** can be used for ever to obtain new access_tokens with `PetscBoxRefresh()`, guard this like a password
it gives access to your Box Drive



## Notes
This call requires stdout and stdin access from process 0 on the MPI communicator

You can run src/sys/webclient/tutorials/boxobtainrefreshtoken to get a refresh token and then in the future pass it to
PETSc programs with -box_refresh_token XXX

This requires PETSc be installed using --with-saws or --download-saws

Requires the user have created a self-signed ssl certificate with

```none
saws/CA.pl  -newcert  (using the passphrase of password)
```
```none
cat newkey.pem newcert.pem > sslclient.pem
```

and put the resulting file in either the current directory (with the application) or in the home directory. This seems kind of
silly but it was all I could figure out.




## See Also
 `PetscBoxRefresh()`, `PetscBoxUpload()`, `PetscURLShorten()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/webclient/box.c.html#PetscBoxAuthorize">src/sys/webclient/box.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/webclient/tutorials/boxobtainrefreshtoken.c.html">src/sys/webclient/tutorials/boxobtainrefreshtoken.c.html</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/webclient/box.c)


[Index of all Sys routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
