oauth_token: Create an OAuth token

Description Usage Arguments Value Examples

View source: R/oauth-token.R

Description

Creates a S3 object of class <httr2_token> representing an OAuth token returned from the access token endpoint.

Usage

1
2
3
4
5
6
7
8
oauth_token(
  access_token,
  token_type = "bearer",
  expires_in = NULL,
  refresh_token = NULL,
  ...,
  .date = Sys.time()
)

Arguments

access_token

The access token used to authenticate request

token_type

Type of token; only "bearer" is currently supported.

expires_in

Number of seconds until token expires.

refresh_token

Optional refresh token; if supplied, this can be used to cheaply get a new access token when this one expires.

...

Additional components returned by the endpoint

.date

Date the request was made; used to convert the relative expires_in to an absolute expires_at.

Value

An OAuth token: an S3 list with class httr2_token.

Examples

1
2
3
oauth_token("abcdef")
oauth_token("abcdef", expires_in = Sys.time() + 3600)
oauth_token("abcdef", refresh_token = "ghijkl")

httr2 documentation built on Sept. 28, 2021, 5:10 p.m.