Learn R Programming

crul (version 0.4.0)

auth: Authentication

Description

Authentication

Usage

auth(user, pwd, auth = "basic")

Arguments

user

(character) username, optional

pwd

(character) password, optional

auth

(character) authentication type, one of basic (default), digest, digest_ie, gssnegotiate, ntlm, or any. optional

Details

Only supporting simple auth for now, OAuth later.

Examples

Run this code
# NOT RUN {
auth(user = "foo", pwd = "bar", auth = "basic")
auth(user = "foo", pwd = "bar", auth = "digest")
auth(user = "foo", pwd = "bar", auth = "ntlm")
auth(user = "foo", pwd = "bar", auth = "any")

# with HttpClient
(res <- HttpClient$new(
  url = "https://httpbin.org/basic-auth/user/passwd",
  auth = auth(user = "user", pwd = "passwd")
))
res$auth
x <- res$get()
jsonlite::fromJSON(x$parse("UTF-8"))

# with HttpRequest
(res <- HttpRequest$new(
  url = "https://httpbin.org/basic-auth/user/passwd",
  auth = auth(user = "user", pwd = "passwd")
))
res$auth
# }

Run the code above in your browser using DataLab