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

Shiny Server Callback URL Mismatch #45

Closed
PaulC91 opened this issue Sep 23, 2019 · 13 comments
Closed

Shiny Server Callback URL Mismatch #45

PaulC91 opened this issue Sep 23, 2019 · 13 comments
Assignees
Labels
solved-review I think it's OK, please review

Comments

@PaulC91
Copy link

PaulC91 commented Sep 23, 2019

Hi all.

I'm trying to get auth0 working on a test app I've deployed on an open source shiny server instance. I've configured nginx routing so that apps can be accessed via https://hostname.com/app_dir where app_dir is the app directory in /srv/shiny-server/ being hosted by shiny server.

I've tried adding https://hostname.com/app_dir to the Allowed Callback URLs and Allowed Logout URLs and https://hostname.com to Allowed Web Origins on my auth0 app but I keep getting a Callback URL mismatch error from auth0 whenever I try to access the app. I noticed the callback error URL contains redirect_uri=http%3A%2F%2Flocalhost%3A3838 so it seems that auth0 is detected localhost:3838 as the callback and not https://hostname.com/app_dir.

Do you know how I can fix this?

Many thanks,
Paul

@jtrecenti jtrecenti self-assigned this Sep 23, 2019
@jtrecenti jtrecenti added the bug Something isn't working label Sep 23, 2019
@jtrecenti
Copy link
Member

This is a bug caused by version 0.2.0. We're checking possible solutions, but probably we'll have to re-add the remote_url parameter

@PaulC91
Copy link
Author

PaulC91 commented Sep 23, 2019

OK great thank you! Is the remote_url parameter in _auth0.yml no longer in use? I do have it in there already as such:

shiny_config: 
  local_url: http://localhost:8080
  remote_url: https://hostname.com/app_dir

@jtrecenti
Copy link
Member

@PaulC91, please try this:

remotes::install_github("curso-r/auth0", ref = "fix-45")

and the _auth0.yml file:

name: myApp
remote_url: 'https://hostname.com/app_dir'
auth0_config:
  api_url: 'https://<tenant>.auth0.com'
  credentials:
    key: <key>
    secret: <secret>

@jtrecenti
Copy link
Member

We thought that it was possible to ignore these parameters, but we only tested in dockerized apps. But it seems that our strategy does not work with shiny-server and shinyapps.io. We're trying to figure out the best workaround

@PaulC91
Copy link
Author

PaulC91 commented Sep 23, 2019

Still getting the same error with localhost:3838 in the callback error url.

I'd be interested to know the appropriate config settings for a dockerized app also. I tried adding auth0 to a dockerized app deployed via shinyproxy but I couldn't get it working either.

Thanks.

@jtrecenti
Copy link
Member

I tested the fix in shiny-server and shinyapps.io and it's working!

Maybe restart your server to make sure that you're using the "fix-45" version of auth0?

We've created a tutorial to make dockerized apps but it's just in Portuguese. We plan to translate it to English and add it to {auth0} package at the end of november.

@PaulC91
Copy link
Author

PaulC91 commented Sep 23, 2019

ah yes sorry I was still using

shiny_config: 
  remote_url: https://hostname.com/app_dir

rather than just remote_url: https://hostname.com/app_dir Working now!

Is session$userData$auth0_info and session$userData$auth0_credentials still the correct way to access this information as they are both now showing NULL in my test app.

@jtrecenti
Copy link
Member

Paul, I messed up with the auth0_info() object. Please install the "fix-45" branch again.

jtrecenti added a commit that referenced this issue Sep 24, 2019
Fix #45 and add documentation to solve #46
@jtrecenti
Copy link
Member

@PaulC91, I've submitted the fix to the master branch. Please re-close the issue if you find any problem.

@jtrecenti jtrecenti reopened this Sep 24, 2019
@jtrecenti jtrecenti added solved-review I think it's OK, please review and removed bug Something isn't working labels Sep 24, 2019
@PaulC91
Copy link
Author

PaulC91 commented Sep 24, 2019

super, thanks Julio! let me know if the Portuguese docker tutorial is available anywhere! :)

@jtrecenti
Copy link
Member

They are in our blog:

  1. How to create your app as a package (using golem)
    https://www.curso-r.com/blog/2019-08-27-app-pacote/

  2. Create dockerized app
    https://www.curso-r.com/blog/2019-09-04-app-docker/

The only difference from (2) and an app using auth0 is that you need to replace shiny::shinyApp() with auth0::shinyAppAuth0() and include the yml file in the same directory of the app.R file.

@IroNEDR
Copy link

IroNEDR commented Dec 14, 2020

I am having the exact same issue using the rocker/shiny-verse:4.0.3 image.
I have configured my allowed callback urls correctly (https://example.domain.com) and the auth0.config has my url with the correct remote_url configured (also using https). But instead, the callback url references the "http://" version. I can manually add in the missing "s" in the url-bar and the app works.
Is it possible that this bug was reintroduced somehow?

@jhlewisjr801
Copy link

Hello, I have the same problem as IroNEDR. I have tried different combinations. My guess is that I have not set up the correct parameters in the shiny-auth directory, the yml file and the autho website. I have tried different examples (as found on the web and in your website) with the negative results. Dropping back to shiny0auth0 is working better than shiny-auth0-plus, but no success. Thanks for any assistance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
solved-review I think it's OK, please review
Projects
None yet
Development

No branches or pull requests

4 participants