User meta-data

Plumber APIs can access the username and groups of the current logged in user by parsing the RStudio-Connect-Credentials request header.

Most environments have unique usernames where each user identifies a single user and groups the name of the groups the user is a member of. In large organizations with hundreds of users, it is possible to have two users with, for example, the same last name and initials, which could result in a duplicated username. If you're expecting such a large number of logged in users to access your Plumber API, please be sure to consult your administrator to confirm whether this condition is possible in your environment. Note that groups may suffer the same issue of duplicates names when users are authenticating against some providers, Azure in particular. If you want to ensure uniqueness of the user or group identifiers RStudio Connect should be configured with the option Authorization.ContentCredentialsUseGUID. When enabled, your content will receive the user and groups GUIDs instead of their names in user and groups. Not only are these values guaranteed to be unique but they can also be used to query for additional information about the user and groups using the Connect Server API.

Group meta-data is populated when using most authentication provider, except LDAP.

Your Plumber API should use the HTTP_RSTUDIO_CONNECT_CREDENTIALS name to obtain the RStudio-Connect-Credentials header value. All HTTP headers are made available on the req request object using a normalized name prefixed with HTTP_.

This simple Plumber API defines a /hello route that greets the arriving user.


# Returns a list containing "user" and "groups" information 
# populated by incoming request data.
getUserMetadata <- function(req) {
    if (!is.null(rawUserData)) {
    } else {

#* @get /hello
function(req, res){
    user <- getUserMetadata(req)
    username <- user[["user"]]
    if (!is.null(username)) {
        return(list(message = paste0("So nice to see you, ", username, ".")))
    } else {
        return(list(message = paste0("Howdy, stranger.")))