Extract username that is logged in

Hi all,

This How do I track user activity within a Shiny application? – RStudio Support
shows how we can capture username through session$user only when we have a shiny login page . But what is happening is, there is no shiny login page, but the organization has separate authentication (non shiny) where the user have to give credentials. Only then the user is able to access the shiny application (deployed on shiny server pro).

In this case , can we not capture sesssion$user ? When I tried it is returning NULL
Can anyone help me?

This sounds like the organization is using an authenticating reverse proxy. Does that reverse proxy add the user name as an HTTP header? If so, you can extract it from session$request.

1 Like

Not sure what you asking as I am new to these terms. But the user logins in with credentials and then it is authenticated by SSO

Shiny Server Pro does not support SSO out of the box (as opposed to it's successor RStudio Connect). What you can use is proxied authentication, which requires you to forward the user name in an HTTP header. It sounds like your reverse proxy only authenticates the user via SSO but does not inform Shiny Server Pro about that.

If you don't understand these terms, it is best if you find the IT department within your organisation which is responsible for the reverse proxy. Show them the documentation linked above and ask them if they can implement something like this within the reverse proxy.

Really thanks for the help

You are welcome! Feel free to reach out to your customer success representative in case of continuing problems.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.