datastorm-open / shinymanager

Simple and secure authentification mechanism for single shiny applications.
https://datastorm-open.github.io/shinymanager/
386 stars 79 forks source link

cannot coerce type 'closure' to vector of type 'character' #60

Closed Rhydderch closed 3 years ago

Rhydderch commented 3 years ago

Hi,

When trying to launch the app (using golem), I encounter the following error:

Warning: Error in as.character: cannot coerce type 'closure' to vector of type 'character' [No stack trace available]

By trial and error, it seems that this error is due to the function "secure_app".

Can I solve this problem in my code or is this related to the package? I'm running R version 4.0.2

Rhydderch commented 3 years ago

I found the error. I put the secure_app at the wrong place:

app_ui <- shinymanager::secure_app(function(request) {
  tagList(
    # Leave this function for adding external resources
    golem_add_external_resources(),
    # List the first level UI elements here
    # Define this page as a dashboard page to signal we're using the dashboard page format

    # rest of ui here ...
  )
})

This might be helpful for anyone using the package "golem".