kntn_get_authorization_header() constructs a header for authorization using add_headers. kntn_set_auth() interactivery asks for the type of authentication and the credential and store them as environmental variables KNTN_URL, KNTN_AUTH_TYPE and KNTN_AUTH. If you want to avoid interaction, please manually set these. kntn_unset_auth() unsets these environmental variables.

kntn_get_authorization_header()

kntn_set_auth(auth_type = c("password", "token"), overwrite = FALSE)

kntn_unset_auth()

Arguments

auth_type

Type of Authentication. password uses username and password. token uses per-app token.

overwrite

If TRUE, overwrite the existing environmental variables.

See also

Examples

# NOT RUN {
# set KNTN_URL, KNTN_AUTH and KNTN_AUTH_TYPE interactively.
# By default, auth_type is password.
kntn_set_auth()

Sys.getenv(c("KNTN_URL", "KNTN_AUTH", "KNTN_AUTH_TYPE"))

# This will return `X-Cybozu-Authorization` header.
kntn_get_authorization_header()

# Clear environmental variables before trying to use another set of authorization info.
kntn_unset_auth()
kntn_set_auth(auth_type = "token")

# This will return `X-Cybozu-API-Token` header.
kntn_get_authorization_header()

# To avoid interaction, set these environmental variables manually.
Sys.setenv("KNTN_URL" = "https://example.cybozu.com/")
Sys.setenv("KNTN_AUTH" = "abcdefg")
Sys.setenv("KNTN_AUTH_TYPE" = "token")
# }