Dear all,
I'm new to using bs4dash, and I'm starting to strongly appreciate its ability to customize the UI.
I am using Auth0 as a service to authenticate the user of my shiny app.
So in order to make the UI professional, I would like to plot the user's profile image into the content of the bs4DashControlbar.
Here below is the code I use, but every time I try it the image doesn't open and stays all white.
In order to test that all my code works, tried to plot the user profile image in the bs4DashBody, and it works correctly here.
Can you help me to understand the reason of the problem.
Thanks.
library(shiny)
library(bs4Dash)
library(auth0)
options(shiny.port=8000)
ui <- bs4DashPage(
old_school = FALSE,
sidebar_min = TRUE,
sidebar_collapsed = TRUE,
controlbar_collapsed = TRUE,
controlbar_overlay = TRUE,
enable_preloader = TRUE,
loading_duration = 2,
loading_background = "Black",
title = "Basic Dashboard",
navbar = bs4DashNavbar(skin = "dark",
status = "black",
sidebarIcon = "bars",
compact = TRUE,
controlbarIcon = "user"),
sidebar = bs4DashSidebar(skin = "light",
status = "primary",
title = "bs4Dash",
brandColor = "primary",
bs4SidebarUserPanel(
text = "Welcome Onboard!"),
bs4SidebarMenu(
bs4SidebarHeader("Header 1"))),
controlbar = bs4DashControlbar(
width = 300,
skin = "light",
bs4DashControlbarItem(
active = TRUE,
tabName = "User profile",
plotOutput(outputId = "image"),
verbatimTextOutput(outputId = "profile"))),
footer = bs4DashFooter(copyrights = a(href = "https://www.agronomofiorentini.it/",
target = "_blank", "@FiorentiniMarco"),
right_text = "2020"),
body = bs4DashBody(
bs4TabItems(
bs4TabItem(
tabName = "item1"))))
server <- function(input, output, session) {
output$image<-renderPlot({
image_url <- session$userData$auth0_info$picture
pic <- image_read(image_url)
plot(pic)
})
output$profile<-renderPrint({
a<-session$userData$auth0_info$nickname
print(a)
})
}
shinyAppAuth0(ui=ui, server = server)