Shiny google login

96 Views Asked by At

I want to implement a google login for my shinyapp, (I have checked this question but it is not working anymore, it seems to be deprecated). I used the example from here instead:

library(shiny)
library(googleAuthR)
options(shiny.port = 1221)

options(googleAuthR.webapp.client_id = "someclientid.apps.googleusercontent.com")
    
ui <- fluidPage(
  
  titlePanel("Sample Google Sign-In"),
  
  sidebarLayout(
    sidebarPanel(
      googleSignInUI("demo")
    ),
    
    mainPanel(
      with(tags, dl(dt("Name"), dd(textOutput("g_name")),
                    dt("Email"), dd(textOutput("g_email")),
                    dt("Image"), dd(uiOutput("g_image")) ))
    )
  )
)

server <- function(input, output, session) {

  sign_ins <- shiny::callModule(googleSignIn, "demo")

  output$g_name = renderText({sign_ins()$name})
  output$g_email = renderText({ sign_ins()$email })
  output$g_image = renderUI({ img(src=sign_ins()$image) })
  
}

# Run the application 
shinyApp(ui = ui, server = server)

But when I login with my account, nothing happens:

This is how it appears before login:

enter image description here

This is the popup after login:

enter image description here

Finally, it returns to this (the same as the begining):

enter image description here

I expected the user information to appear next to Name Email and Image. Not sure if I miss something. Any suggestion?

0

There are 0 best solutions below