req_auth_bearer_token {httr2} | R Documentation |
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.
req_auth_bearer_token(req, token)
req |
A request. |
token |
A bearer token |
A modified HTTP request.
RFC750 The OAuth 2.0 Authorization Framework: Bearer Token Usage
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)