Skip to content

For internal use or for those programming around the Drive API. Returns a token pre-processed with httr::config(). Most users do not need to handle tokens "by hand" or, even if they need some control, drive_auth() is what they need. If there is no current token, drive_auth() is called to either load from cache or initiate OAuth2.0 flow. If auth has been deactivated via drive_deauth(), drive_token() returns NULL.

Usage

drive_token()

Value

A request object (an S3 class provided by httr).

See also

Other low-level API functions: drive_has_token(), request_generate(), request_make()

Examples

req <- request_generate(
  "drive.files.get",
  list(fileId = "abc"),
  token = drive_token()
)
req
#> $method
#> [1] "GET"
#> 
#> $url
#> [1] "https://www.googleapis.com/drive/v3/files/abc?supportsAllDrives=TRUE"
#> 
#> $body
#> named list()
#> 
#> $token
#> <request>
#> Auth token: TokenServiceAccount
#>