Stores an OAuth2 access token and/or refresh token in global options for use in subsequent authenticated API requests. Use vb_unset_token() to clear previously stored tokens.
Details
Two input modes are supported — use one or the other, not both:
Individual strings: pass
access_token,refresh_token, or both.Token dict: pass
tokensas a named list or JSON string withaccess_tokenand/orrefresh_tokenkeys.
Examples
vb_set_token(access_token = "eyJhbGciOiJIUzI1NiJ9...")
#> VegBank token(s) updated: access token
#> Note: no refresh token provided. Provide a refresh token via vb_set_token() to enable automatic renewal.
vb_set_token(access_token = "eyJ...", refresh_token = "eyJ...")
#> VegBank token(s) updated: access token and refresh token
vb_set_token(tokens = list(access_token = "eyJ...", refresh_token = "eyJ..."))
#> VegBank token(s) updated: access token and refresh token
vb_set_token(tokens = '{"access_token": "eyJ...", "refresh_token": "eyJ..."}')
#> VegBank token(s) updated: access token and refresh token