MarkEdmondson1234 / googleAuthR

Google API Client Library for R. Easy authentication and help to build Google API R libraries with OAuth2. Shiny compatible.
https://code.markedmondson.me/googleAuthR
Other
175 stars 51 forks source link

How can we prevent automatic sign in on Shiny in R (and instead always show the email chooser)? #140

Closed suveer14 closed 5 years ago

suveer14 commented 5 years ago

Hello,

I am creating a Shiny App using R with a login page to authorize users. Every time I use this app, I can only sign in once. This means that when I sign out and try to sign in again, I am automatically signed into the original email that I signed in with at first. This way, I am unable to use a different email id for my second or subsequent sign in to the app. I would appreciate any help possible. I think it would just be something that I need to add the the callModule function?

I am using code very similar (and thanks for sharing it!) to the googleSignIn module here: https://code.markedmondson.me/googleAuthR/articles/google-authentication-types.html#googlesignin-module-example

Thank you!

MarkEdmondson1234 commented 5 years ago

That is kinda the point of the SignIn module, it uses a Google cookie to keep your details. If you can find the functionality you want in this documentation, I will look at adding it to the JavaScript the module uses.

MarkEdmondson1234 commented 5 years ago

Perhaps implementing a logout button using this? https://developers.google.com/identity/sign-in/web/disconnect

suveer14 commented 5 years ago

Yes that logout button that deletes the association between the user and and the app could solve the issue, hopefully. Is that JS code something I that I would have to incorporate into my R Script?

suveer14 commented 5 years ago

Or, would you have to add it to the module/package? Thanks so much!

MarkEdmondson1234 commented 5 years ago

I just checked and its there already - if I sign out then I need to login with a new choice of Google account.

screenshot 2019-02-28 at 22 10 21
MarkEdmondson1234 commented 5 years ago

But I see your problem now - that choice only presents itself when I'm logged into multiple Google accounts in my browser generally. If I try in a new incognito browser, then I get logged straight in without a choice.

As a work around you could try logging in with your other Google account in another service first before opening the app.

e.g. click top right here and log in to another Google account https://myaccount.google.com/?pli=1 then open the app

But if you find a way to force a signin each time, I will be happy to implement it within the module.