key <- reqres::random_key()
api() |>
api_session_cookie(key, secure = TRUE) |>
api_get("/", function(request) {
if (isTRUE(request$session$foo)) {
msg <- "You've been here before"
} else {
msg <- "You must be new here"
request$session$foo <- TRUE
}
list(
msg = msg
)
})
Run the code above in your browser using DataLab