kntn_auth: Authorization Header for 'kintone'

Description Usage Arguments See Also Examples

Description

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.

Usage

1
2
3
4
5
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

https://developer.kintone.io/hc/en-us/articles/212495188/#userauthentication

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## 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")

## End(Not run)

yutannihilation/kntnr documentation built on July 16, 2020, 9 p.m.