forked from r-lib/httr2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreq_oauth_client_credentials.Rd
More file actions
64 lines (57 loc) · 2.08 KB
/
Copy pathreq_oauth_client_credentials.Rd
File metadata and controls
64 lines (57 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/oauth-flow-client-credentials.R
\name{req_oauth_client_credentials}
\alias{req_oauth_client_credentials}
\alias{oauth_flow_client_credentials}
\title{OAuth with client credentials}
\usage{
req_oauth_client_credentials(
req,
client,
scope = NULL,
token_params = list(),
expiry_margin = 30
)
oauth_flow_client_credentials(client, scope = NULL, token_params = list())
}
\arguments{
\item{req}{A httr2 \link{request} object.}
\item{client}{An \code{\link[=oauth_client]{oauth_client()}}.}
\item{scope}{Scopes to be requested from the resource owner.}
\item{token_params}{List containing additional parameters passed to the
\code{token_url}.}
\item{expiry_margin}{Number of seconds before a token's stated expiry that
it should be treated as expired. Increase this for servers that reject
tokens shortly before they expire. Defaults to 30 seconds.}
}
\value{
\code{req_oauth_client_credentials()} returns a modified HTTP \link{request} that will
use OAuth; \code{oauth_flow_client_credentials()} returns an \link{oauth_token}.
}
\description{
Authenticate using OAuth \strong{client credentials flow}, as defined by
\href{https://datatracker.ietf.org/doc/html/rfc6749#section-4.4}{Section 4.4 of RFC 6749}. It is used to allow the client to access resources that
it controls directly, not on behalf of an user.
Learn more about the overall OAuth authentication flow in
\url{https://httr2.r-lib.org/articles/oauth.html}.
}
\examples{
req_auth <- function(req) {
req_oauth_client_credentials(
req,
client = oauth_client("example", "https://example.com/get_token")
)
}
request("https://example.com") |>
req_auth()
}
\seealso{
Other OAuth flows:
\code{\link[=oauth_server_metadata]{oauth_server_metadata()}},
\code{\link[=req_oauth_auth_code]{req_oauth_auth_code()}},
\code{\link[=req_oauth_bearer_jwt]{req_oauth_bearer_jwt()}},
\code{\link[=req_oauth_password]{req_oauth_password()}},
\code{\link[=req_oauth_refresh]{req_oauth_refresh()}},
\code{\link[=req_oauth_token_exchange]{req_oauth_token_exchange()}}
}
\concept{OAuth flows}