Learn R Programming

boxr (version 0.3.3)

box_auth: Authenticate a box.com Account

Description

box_auth serves two purposes:
  1. Setting up box.com accounts with boxr for the first time
  2. Connecting to previously used box.com accounts

In either case, it should be sufficient to run box_auth() with no parameters. If you've authenticated with boxr before, this should be all that is required. However, the first time you use boxr, the process is slightly more involved (see 'Getting Set-Up' below).

Usage

box_auth(client_id = "", client_secret = "", interactive = TRUE, cache = "~/.boxr-oauth", write.Renv = TRUE, ...)

Arguments

client_id
Optional. The client id for the account you'd like to use. character.
client_secret
Optional. The client secret for the account you'd like to use. character.
interactive
logical. Should the authorization process happen interactively (requiring user input to the R console, and/or a visit to box.com)?
cache
Passed to cache in httr.
write.Renv
logical. If authentication was successful, should client_id and client_secret be written to .Renvirons in your HOME directory?
...
Passed to oauth2.0_token

Value

Returns TRUE if connection successful, throws an error otherwise. Invoked for it's side effect; OAuth2.0 connection to the box.com API.Your client_id and client_secret will be written to ~/.Renviron for future use, and a token object will be wrttien to the path supplied bu cache (~/.boxr-oauth by default).See oauth2.0_token for details.

Getting Set-Up

A version of this guide is in the package vignette, with some additional screenshots. To view the vignette, run vignette("boxr"). To use boxr for the first time, you need to enable API access for your box.com account. The process is slightly annoying. You only need to do it once - it takes around 2 minutes. The next time you use boxr, you should be able to just run box_auth() (without entering anything else) to be authenticated and ready-to-go.
A browser window should open, for you to formally grant yourself access to your files at box.com. From this point on, simply running box_auth() at the start of a session should be all that is required.

See Also

box_auth_on_attach, oauth2.0_token for details of how the tokens are handled