Posit Cloud uses a cookie to identify the user. The output of this function can be used to add a "/cookie" endpoint to an api in order to allow users to easily extract their Posit Cloud cookie for your endpoint.
Arguments
- default_cookie_name
Character. The name of the cookie to use if the user does not request a different cookie.
Examples
cookie_endpoint_simple()
#> plumber::pr_get("/cookie", function(req) {
#> cookie_nm <- req$argsQuery[["cookie_name"]]
#> if (is.null(cookie_nm)) cookie_nm <- "therealshinyapps"
#> req$cookies[[cookie_nm]]
#> }, serializer = plumber::serializer_text())
cookie_endpoint_simple("another_cookie_name")
#> plumber::pr_get("/cookie", function(req) {
#> cookie_nm <- req$argsQuery[["cookie_name"]]
#> if (is.null(cookie_nm)) cookie_nm <- "another_cookie_name"
#> req$cookies[[cookie_nm]]
#> }, serializer = plumber::serializer_text())