Creates a S3 object of class <httr2_token> representing an OAuth token
returned from the access token endpoint.
oauth_token(
access_token,
token_type = "bearer",
expires_in = NULL,
refresh_token = NULL,
...,
.date = Sys.time()
)The access token used to authenticate request
Type of token; only "bearer" is currently supported.
Number of seconds until token expires.
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 the request was made; used to convert the relative
expires_in to an absolute expires_at.
An OAuth token: an S3 list with class httr2_token.
oauth_token_cached() to use the token cache with a specified
OAuth flow.
oauth_token("abcdef")
#> <httr2_token>
#> * token_type : "bearer"
#> * access_token: <REDACTED>
oauth_token("abcdef", expires_in = 3600)
#> <httr2_token>
#> * token_type : "bearer"
#> * access_token: <REDACTED>
#> * expires_at : "2025-07-29 20:04:59"
oauth_token("abcdef", refresh_token = "ghijkl")
#> <httr2_token>
#> * token_type : "bearer"
#> * access_token : <REDACTED>
#> * refresh_token: <REDACTED>