Comments (7)
Hi Naly, could you provide a reproducible example of how you are using this package with googleAuthR
?
There is no password caching in shinyauthr
so you will always have to provide your credentials each time the app is launched.
One workaround would be to use a password manager like Dashlane and save your credentials for the app using shinyauthr
. It should then automatically log you in whenever you visit the URL the app is hosted on.
from shinyauthr.
Hello Paul,
Thanks for your answer.
I think what I said was not clear.
Actually, the issues is that I have to re-enter the shinyauthr
login/password during the same session.
You can see in the screenshot what's happening during the same session :
**Step 2 : After Login via shinyauthr
**
Succesfully logged in
Step 3 : After login with my google account (via googleAuthR
)
shinyauthr
asks me to enter my id and password again
Here's a reproducible example (you just have to add the google console infos)
llibrary(shiny)
library(shinyauthr)
library(shinyjs)
library(googleAuthR)
# set google console infos
options("googleAuthR.webapp.client_id" = "xxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxx.apps.googleusercontent.com")
options("googleAuthR.webapp.client_secret" = "xxxxxxxxxxxxxxxxxx")
options(shiny.port = 4441)
# dataframe that holds usernames, passwords and other user data
user_base <- data.frame(
user = c("user1", "user2"),
password = c("pass1", "pass2"),
permissions = c("admin", "standard"),
name = c("User One", "User Two"),
stringsAsFactors = FALSE
)
ui <- fluidPage(
# must turn shinyjs on
shinyjs::useShinyjs(),
# add logout button UI
div(class = "pull-right", shinyauthr::logoutUI(id = "logout")),
# add login panel UI function
shinyauthr::loginUI(id = "login"),
# setup table output to show user info after login
conditionalPanel(
condition = "output.authOK == 'TRUE'",
tableOutput("user_table"),
googleAuthUI("login")
)
)
server <- function(input, output, session) {
# call the logout module with reactive trigger to hide/show
logout_init <- callModule(shinyauthr::logout,
id = "logout",
active = reactive(credentials()$user_auth))
# call login module supplying data frame, user and password cols
# and reactive trigger
credentials <- callModule(shinyauthr::login,
id = "login",
data = user_base,
user_col = user,
pwd_col = password,
log_out = reactive(logout_init()))
# pulls out the user information returned from login module
user_data <- reactive({credentials()$info})
output$user_table <- renderTable({
# use req to only render results when credentials()$user_auth is TRUE
req(credentials()$user_auth)
user_data()
})
output$authOK <- renderText({
credentials()$user_auth
})
outputOptions(output, "authOK", suspendWhenHidden = FALSE)
user <- shiny::callModule(googleAuth, "login")
}
shinyApp(ui = ui, server = server)
Thanks again.
EDIT : I think that, as the googleAuthUI
function sends me in another page (external to the shiny app), the user_auth
value is reset to FALSE
.
from shinyauthr.
Hi Naly, yes it looks like the googleAuthR
login is resetting the user_auth
value.
Is there a reason you need both a shinyauthr
login as well as a googleAuthR
one?
from shinyauthr.
That's right, I need both of them (actually, maybe I'll need another login, too : facebook for example). The shinyauthr
one will be for the whole app, the other ones will be used inside it to extract some data from those sources.
from shinyauthr.
I think I've found a solution : instead of using googleAuthUI
, I'll use googleAuth_jsUI(...)
, from the same package, so the google authentication will be done from a popup JS menu (so I won't be redirected at an external page).
from shinyauthr.
OK give that a go and let me know how it goes.
If the shinyauthr
login isn't being used for any server-side processes, just simply to limit access to the app, I would suggest switching to something like Nginx authentication with shiny server: https://www.r-bloggers.com/add-authentication-to-shiny-server-with-nginx/
from shinyauthr.
Hello @PaulC91 ,
Thanks for your reply.
Nginx seems to be a good idea.
Thanks a lot.
from shinyauthr.
Related Issues (20)
- About loginUI title Simple Chinese does not work HOT 8
- Additional info in the login box HOT 2
- Background and text colour HOT 1
- Issue adding a loading icon/spinner HOT 1
- live example app down? HOT 3
- CRAN submission HOT 3
- How to enable password coding by setting "sodium_hashed" parameter? HOT 2
- Reload session when logging out? HOT 14
- Error object 'js' not found HOT 8
- Error in shiny::isTruthy: attempt to apply non-function HOT 2
- Option to bypass/deactivate the login
- Error: shinyjs: Error parsing the JavaScript code provided. HOT 1
- shinydashboard shows app without login using shinyauthr HOT 1
- White font color on login button is difficult to see HOT 3
- login error after shiny timeout HOT 4
- Beautify the login window suggestion HOT 3
- Where should I put the data for my own app in shinyboard? HOT 1
- Cases for help HOT 2
- Using shinyauthr with shiny rmarkdown documents HOT 1
- Log password failures HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from shinyauthr.