Examples for 'crul::auth'


Authentication

Aliases: auth

Keywords:

### ** Examples

auth(user = "foo", pwd = "bar", auth = "basic")
$userpwd
[1] "foo:bar"

$httpauth
[1] 1

attr(,"class")
[1] "auth"
attr(,"type")
[1] "basic"
auth(user = "foo", pwd = "bar", auth = "digest")
$userpwd
[1] "foo:bar"

$httpauth
[1] 2

attr(,"class")
[1] "auth"
attr(,"type")
[1] "digest"
auth(user = "foo", pwd = "bar", auth = "ntlm")
$userpwd
[1] "foo:bar"

$httpauth
[1] 8

attr(,"class")
[1] "auth"
attr(,"type")
[1] "ntlm"
auth(user = "foo", pwd = "bar", auth = "any")
$userpwd
[1] "foo:bar"

$httpauth
[1] -17

attr(,"class")
[1] "auth"
attr(,"type")
[1] "any"
# gssnegotiate auth
auth(NULL, NULL, "gssnegotiate")
$httpauth
[1] 4

attr(,"class")
[1] "auth"
attr(,"type")
[1] "gssnegotiate"
## Not run: 
##D # with HttpClient
##D (res <- HttpClient$new(
##D   url = "https://hb.opencpu.org/basic-auth/user/passwd",
##D   auth = auth(user = "user", pwd = "passwd")
##D ))
##D res$auth
##D x <- res$get()
##D jsonlite::fromJSON(x$parse("UTF-8"))
##D 
##D # with HttpRequest
##D (res <- HttpRequest$new(
##D   url = "https://hb.opencpu.org/basic-auth/user/passwd",
##D   auth = auth(user = "user", pwd = "passwd")
##D ))
##D res$auth
## End(Not run)

[Package crul version 1.5.0 Index]