req_auth_bearer_token {httr2} | R Documentation |
Authenticate request with bearer token
Description
A bearer token gives the bearer access to confidential resources (so you should keep them secure like you would with a user name and password). They are usually produced by some large authentication scheme (like the various OAuth 2.0 flows), but you are sometimes given then directly.
Usage
req_auth_bearer_token(req, token)
Arguments
req |
A request. |
token |
A bearer token |
Value
A modified HTTP request.
See Also
See RFC 6750 for more details about bearer token usage with OAuth 2.0.
Examples
req <- request("http://example.com") |> req_auth_bearer_token("sdaljsdf093lkfs")
req
# httr2 does its best to redact the Authorization header so that you don't
# accidentally reveal confidential data. Use `redact_headers` to reveal it:
print(req, redact_headers = FALSE)
[Package httr2 version 1.0.2 Index]