Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use shinyjs in the authorisation page of a shinymanager app #258

Closed
pepijn-devries opened this issue Oct 31, 2022 · 3 comments
Closed

Use shinyjs in the authorisation page of a shinymanager app #258

pepijn-devries opened this issue Oct 31, 2022 · 3 comments

Comments

@pepijn-devries
Copy link

Hi @daattali,

I'm using the shinymanager package, which allows me to check credentials before granting users to the main page. This is achieved by wrapping the ui object inside a call to secure_app. Putting a call to useShinyjs() inside the original ui will not affect the authorisation page, where the user will start. Consequently, the server is not able to call javascript functions using runjs, when on this page. It took me a while to figure out that if you want to achieve this, you will need to add the following argument to the secure_app function: ui <- secure_app(ui, head_auth = useShinyjs()).

Maybe this usage can be added to the following vignette, to help others that are struggling with the same issue?:

https://cran.r-project.org/web/packages/shinyjs/vignettes/shinyjs-usage.html

@daattali
Copy link
Owner

I'd be happy to accept a PR if you want to add a short section for this in the vignette.

@daattali
Copy link
Owner

I've been thinking about this for a little while and looked at some example usages of {shinymanager}. In my opinion, this is out of scope for shinyjs, and is much better suited to be documented by {shinymanager}.

The secured_app() function needs to make it clear that the page's UI is not executed before being authorized, and therefore any scripts there will not take effect. The documentation for the head_auth parameter is unclear, I myself read it and did not understand that javascript code can go in there. I'm sorry I asked you to submit a PR, but I do very strongly believe this type of documentation should be done in the other package. It would also help people in other contexts, not just with shinyjs.

@daattali daattali closed this as not planned Won't fix, can't repro, duplicate, stale Jan 16, 2023
@pepijn-devries
Copy link
Author

Thank you for reflecting on this. After reading your comment I agree that this would be better suited in the shinymanager documentation. I will open an issue there with a reference to this issue...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants