New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logout Button doesn't work on shinyapps.io ? #17

Closed
rwutzke opened this Issue Jan 28, 2016 · 4 comments

Comments

Projects
None yet
2 participants
@rwutzke

rwutzke commented Jan 28, 2016

I just realized, that the Logout button doesn't work as expected when used @shinyapps.io . When I run the code locally everything works fine, but when I push the same project to the shinyapps platform, the logout button somewhere gets stuck.
It seems to me that the redirection to the base URL (without the query part ?state=xyz&code=xyz) doesn't work. The URL is set correctly in the link of the button (to the base URL) but it still "redirects" to the same page, ie with the query part. The token gets revoked in the process, so it's invalid, but still since the query parameters are set (with now invalid data) the button still shows 'Logout' and the function reactiveAccessToken(session) generates an (invalid) access token.

Any idea why this happens? The only difference between those two scenarios is as far as I can see the domain (localhost vs shinyapps), the protocol (http vs https), the subfolder the app is in ('/' vs '/appname'), and possibly the 'shiny engine' (the shinyapps server might use a different version?). But I don't see how any of this should affect the behaviour of the button?

In the network traffic I can see that even if the link of the button is set to the base URL, the URL including query string is being queried. Also I just realized that once the Logout Button is clicked the href attribute of the link changes from the base URL to the URL including the query string (with the state and code variable).

Would appreciate any help or hints :)

@MarkEdmondson1234

This comment has been minimized.

Show comment
Hide comment
@MarkEdmondson1234

MarkEdmondson1234 Jan 28, 2016

Owner

Ahh, you are probably running into shinyapps.io's iframe they have around all apps, that has caused no ends of issues :) I will take a look at this.

Owner

MarkEdmondson1234 commented Jan 28, 2016

Ahh, you are probably running into shinyapps.io's iframe they have around all apps, that has caused no ends of issues :) I will take a look at this.

@rwutzke

This comment has been minimized.

Show comment
Hide comment
@rwutzke

rwutzke Jan 28, 2016

Ah, right on, thanks!

rwutzke commented Jan 28, 2016

Ah, right on, thanks!

@MarkEdmondson1234

This comment has been minimized.

Show comment
Hide comment
@MarkEdmondson1234

MarkEdmondson1234 Mar 17, 2016

Owner

Shinyapps.io now doesn't use an iframe, but this still doesn't work so I'll look at what URL its using for the button

Owner

MarkEdmondson1234 commented Mar 17, 2016

Shinyapps.io now doesn't use an iframe, but this still doesn't work so I'll look at what URL its using for the button

@MarkEdmondson1234

This comment has been minimized.

Show comment
Hide comment
@MarkEdmondson1234

MarkEdmondson1234 Apr 16, 2016

Owner

So due to the funny way shinyapps.io treats this links this is still not ideal, but a workaround is to use JavaScript to redirect a user when they click on a button, that is easy to add if using https://github.com/daattali/shinyjs

Example code:

in server.R

observeEvent(input$reset_button, {

    shinyjs::runjs("window.location.href = 'https://yoursubdomain.shinyapps.io/yourapp';")

})

in ui.R

actionButton("reset_button", "Restart", icon = icon("undo"), class = "btn-info"))
Owner

MarkEdmondson1234 commented Apr 16, 2016

So due to the funny way shinyapps.io treats this links this is still not ideal, but a workaround is to use JavaScript to redirect a user when they click on a button, that is easy to add if using https://github.com/daattali/shinyjs

Example code:

in server.R

observeEvent(input$reset_button, {

    shinyjs::runjs("window.location.href = 'https://yoursubdomain.shinyapps.io/yourapp';")

})

in ui.R

actionButton("reset_button", "Restart", icon = icon("undo"), class = "btn-info"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment