Skip to content
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

Accidental URL decoding of query parameters #64

Open
Kvit opened this issue Feb 14, 2020 · 5 comments
Open

Accidental URL decoding of query parameters #64

Kvit opened this issue Feb 14, 2020 · 5 comments
Labels
bookmarking Problems related to bookmarking

Comments

@Kvit
Copy link

Kvit commented Feb 14, 2020

When using Shiny app with URL-encoded parameters, the library accidentally decodes them which makes URL incorrect. For example, try parameter like/?param=two%20words , it will become /?param=two words and you will get an error from Auth0:

invalid_request: The redirect_uri parameter is not valid: "http://localhost:8080/?param=two words" If url looks fine, check that you are not including non printable chars

@Kvit Kvit changed the title Accidental URL decoding in query parameters Accidental URL decoding of query parameters Feb 14, 2020
@pmoulos
Copy link

pmoulos commented Feb 20, 2020

Hi,
Can you check if the latest commit here fixes that?
Thanks

@Kvit
Copy link
Author

Kvit commented Feb 21, 2020

Hi,
Can you check if the latest commit here fixes that?
Thanks

@pmoulos , unfortunately your latest branch does not fix the problem, sill gettting error:

{
  "date": "2020-02-21T15:27:29.365Z",
  "type": "f",
  "description": "The redirect_uri parameter is not valid: \"http://localhost:8080/?param=two words\" If url looks fine, check that you are not including non printable chars"
}

@Kvit
Copy link
Author

Kvit commented Mar 5, 2020

@pmoulos, any additional thoughts on this issue?

@pmoulos
Copy link

pmoulos commented Mar 21, 2020

Hi @Kvit,

Are you sure that this can be achieved? I think that there is an incompatibility between how Shiny bookmarking encodes parameters in the URL so that Shiny can understand them and how auth0 parses the URL. This is why @jtrecenti states this about how bookmarking should be done to use the auth0 service with Shiny. So I am not sure that encoding bookmarking parameters in the URL is possible and one should use enableBookmarking(store="server") with potential inconveniences though (e.g. having to manage the created states in the server). For my cases this not a problem as I usually have many parameters to be bookmarked so I use server store anyway.

Regards

@Kvit
Copy link
Author

Kvit commented Mar 23, 2020

I'm not using standard Bookmarking - too messy. I parse URL reactively, and I use URL encoding/decoding. It works fine without Auth0 "wrapping"

require(shiny)
require(magrittr)
# ---- observe URL ----
  observe({
    # get params from url
    query <- parseQueryString( req( session$clientData$url_search ) ) %>% unlist()
  })
 # make url
    url_share<-paste0(session$clientData$url_protocol,"//", session$clientData$url_hostname
                      ,ifelse(session$clientData$url_port!='', paste0( ":", session$clientData$url_port), '')
                      ,session$clientData$url_pathname
                      , "?", URLencode(query)
    )

@jtrecenti jtrecenti added the bookmarking Problems related to bookmarking label Apr 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bookmarking Problems related to bookmarking
Projects
None yet
Development

No branches or pull requests

3 participants