Use http authentication from environment variable, keychain or prompt Wraps httr::authenticate() for convenience. See get_pass2() for details.

authenticate2(user, password = NULL, type = "basic", service, keyring = NULL)

Arguments

user

user name

password

password

type

type of HTTP authentication. Should be one of the following types supported by Curl: basic, digest, digest_ie, gssnegotiate, ntlm, any. It defaults to "basic", the most common type.

service

[character(1)] giving the service to authenticate against with user and password, for example "foo-service.com". Also used to retrieve from and store the password in keyring. If a longer URL is provided, the domain is extracted using urltools::domain(), which is the conventional name for storing secrets (for example, "foo-service.com", not "https://foo-service.com/api").

keyring

For systems that support multiple keyrings, specify the name of the keyring to use here. If NULL, then the default keyring is used. See also has_keyring_support().

Details

Key and token-based authentication is more secure and convenient; use basic authentication (BA, aka. username and password) only if unavoidable and at your own risk. Read the httr vignette on managing secrets for details.