How to properly use uiFunc(req) in a shiny app ?

As @jcheng puts it "This is not widely known" and @hadley also said "A little-known feature of Shiny is that the UI can be a function" but I can't find any documentation about this feature.
How do I know what's inside this "req" object when I use uiFunc(req) like in this gist https://gist.github.com/jcheng5/44bd750764713b5a1df7d9daf5538aea ?
I know there is this QUERY_STRING parameter but what are the other values and how are they evaluated ?
Any help or redirection to the right documentation would be greatly appreciated.

The req object is a Rook request. This is just an environment object that
gives you access to the request URL, HTTP headers, etc. The documentation
for this object is here:

1 Like

This topic was automatically closed 54 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.

You haven't exactly described your use case, i.e. why you are pursuing this in the first place ?
i.e. what do you want to accomplish, that led you to these functions.
I'm not saying I will be able to help you once you do this, but it would help me decide if I can add value for you or not (and presumably other forum users too)

Great, that's awesome, thank you @nirgrahamuk, but still it's mysterious how I'm supposed to work with this in a shiny App

  1. How do I simply access this env on the server side ?
  2. How can I interact with it (modify from the server side) ? If I use bookmarking I can use updateQueryString() to change the hash or query string (but cannot remove/reset them ?), what about the other items ?

You cannot send the req object to the server, at least not in any remotely secure way. However, if you can wait a couple of weeks, you'll have a much more thoroughly worked example to go off of. You can participate in the discussion here if you like: https://github.com/r-lib/gargle/pull/157

My use case here is the authentication on a shiny app.
I want the user to be able to log either with simple user/password they were provided, or using oauth2.0 on a custom domain.
I found inspiration here : https://gist.github.com/hadley/144c406871768d0cbe66b0b810160528
This is my PoC : https://gist.github.com/phileas-condemine/4c57ce92e044adb5d9ce6ea155b02e24
It works but I'd like to know the full potential of using ui functions for any purposes as I develop many shiny apps.
For instance, how do I properly send this req object to the server ?