Do you use the authentication mechanism from within RStudio connect ? That is to say your app is not public and you have to log in as a user to rstudio connect to see the app.
And Have you changed the user who run the application to the identified user ?
Sys.getenv("USER") to `rstudio-connect because by default this the unix user that runs all the content unless you say otherwise.
With RStudio connect, you can get information for identified user in the
session$user value in a shiny app. You can look at this documentation to know more
This will allow you to have customized application depending on who is consulting it. See some examples:
Also RStudio connect allows to change the user who runs an application. For that, the user would have to be identified on the server, and the parameter should have been change in the app setting
With this, the application will run on the system (on the server) using an account corresponding to another user, or the identified user directly. This is required if you have some control ressource or control access based on the linux account you want to be used by your app. Otherwise, the previous solution should be the one you are looking for to identify current user with