Skip to contents

Adds OSF auth and accept headers to an httr2 request.

Usage

.osf_headers(req, pat = .key_use("osf", check = .osf_key_check))

Arguments

req

an httr2 request object

pat

an OSF personal access token to authorise the request with. Defaults to the token set by osf_pat(), which falls back to the OSF_PAT environment variable (normally set in .Renviron), left out when the OSF refuses it (see api_key_status()). .osf_headers() is passed bare as a request configurator in several places (e.g. as .batch_query(req_func = )), so a token supplied for a whole run is set with osf_pat() rather than threaded through every call site. Named pat rather than osf_pat because an argument of that name would shadow the osf_pat() function supplying its own default.

Value

the modified request