There are two common use-cases for box_auth()
:
Connecting to box.com accounts from boxr for the first time.
Connecting to previously-connected box.com accounts.
In the first case, you will need to provide box_auth()
with
client_id
and client_secret
.
In the second case, you can call box_auth()
with no arguments;
the function will look for these in your R environment.
To run this function the first time, you will need access to the client_id
and client_secret
of a Box interactive-app. If you are using a work account,
this information might be provided to you by your Box-admin team. If you are
using a personal account, you will have to set up a Box interactive-app.
For both cases, these procedures are detailed in this boxr interactive-app article.
box_auth( client_id = NULL, client_secret = NULL, interactive = TRUE, cache = "~/.boxr-oauth", write.Renv, ... )
client_id |
|
---|---|
client_secret |
|
interactive |
|
cache | A logical value or a string. |
write.Renv | deprecated. |
... | Other arguments passed to |
Invisible NULL
, called for side effects.
This function has some side effects which make subsequent calls to
box_auth()
easier:
a browser window may be opened at box.com, for you to authorize to your Box app.
a token file is written, according to the value of cache
. The default
behaviour is to write this file to ~/.boxr-oauth
.
some global options()
are set for your session to manage the token.
environment variables BOX_USER_ID
, BOX_CLIENT_ID
,
and BOX_CLIENT_SECRET
are set.
if these environment variables have changed, and you have the
usethis package installed, it will copy
some text to your clipboard that you can paste into your .Renviron
file.
a message is printed to the console.
box_auth_service()
for authenticating to service-apps.
httr::oauth2.0_token()
for details on how tokens are handled.
documentation for setting up Box (interactive) apps with OAuth 2.0.