Giter Club home page Giter Club logo

shiny-auth0's Introduction

Auth0 + Shiny proxy

This server proxies a shiny instance protecting it with Auth0

Running the proxy

In order to run this proxy you need to have npm and nodejs installed.

You also need to set the ClientSecret, ClientId and Domain for your Auth0 app as environment variables with the following names respectively: AUTH0_CLIENT_SECRET, AUTH0_CLIENT_ID and AUTH0_DOMAIN.

For that, if you just create a file named .env in the directory and set the values like the following, the app will just work:

# .env file
AUTH0_CLIENT_SECRET=myCoolSecret
AUTH0_CLIENT_ID=myCoolClientId
AUTH0_DOMAIN=myCoolDomain
AUTH0_CALLBACK_URL=https://my.url.com/
COOKIE_SECRET=somethingRandomHerePlease
SHINY_HOST=localhost
SHINY_PORT=3838
PORT=3000
LOGOUT_URL=https://my.url.com/afterLogout

Once you've set those 3 environment variables, just run npm start and try calling http://localhost:3000/

For further customization you can add the following variables to your .env file

# Auto login if the session exists on Auth0 Server
CHECK_SESSION=true
# When logout is called, log the user out of Auth0 aswell
LOGOUT_AUTH0=true
# When logging out is called, must logout of remote idp aswell
# This will force LOGOUT_AUTH0 to true
LOGOUT_FEDERATED=true

shiny-auth0's People

Contributors

aaguiarz avatar danoncall avatar darkyen avatar dependabot[bot] avatar hengqujushi avatar lbalmaceda avatar richpauloo avatar sebadoom avatar sicarul avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

shiny-auth0's Issues

404 error with app hosted in directory other than /Reports

I get the following 404 error when I navigate to any app that's hosted on a directory other than /Reports:

Not Found
404
Error: Not Found
    at /home/ubuntu/shiny-auth0/app.js:75:13
    at Layer.handle [as handle_request] (/home/ubuntu/shiny-auth0/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/home/ubuntu/shiny-auth0/node_modules/express/lib/router/index.js:317:13)
    at /home/ubuntu/shiny-auth0/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/home/ubuntu/shiny-auth0/node_modules/express/lib/router/index.js:335:12)
    at next (/home/ubuntu/shiny-auth0/node_modules/express/lib/router/index.js:275:10)
    at urlencodedParser (/home/ubuntu/shiny-auth0/node_modules/body-parser/lib/types/urlencoded.js:88:40)
    at Layer.handle [as handle_request] (/home/ubuntu/shiny-auth0/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/home/ubuntu/shiny-auth0/node_modules/express/lib/router/index.js:317:13)
    at /home/ubuntu/shiny-auth0/node_modules/express/lib/router/index.js:284:7

Any ideas?

HTTP/2 support

Describe the problem you'd like to have solved

I enabled http2 directive on nginx but recieved an ERR_HTTP2_PROTOCOL_ERROR from shiny-auth0

Describe the ideal solution

TLSv1.3 and HTTP2/support

Requires health check endpoint

We're planning on running this application within our Kubernetes cluster - it'd be nice if it had a /healthz route which simply returned a 200 with OK.

Please help: 502 gateway issue

Dear Auth0 team,

I am following the guide from https://auth0.com/blog/adding-authentication-to-shiny-server/ but encountered a 502 gateway error.

The error messages are as follows if I manually run the service...:

/usr/bin/node /home/ubuntu/shiny-auth0/bin/www

Error: ENOENT: no such file or directory, open '.env'
at Object.openSync (fs.js:458:3)
at Object.readFileSync (fs.js:360:35)
at Object.config (/home/ubuntu/shiny-auth0/node_modules/dotenv/lib/main.js:30:37)
at Object. (/home/ubuntu/shiny-auth0/app.js:12:8)
at Module._compile (internal/modules/cjs/loader.js:1138:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
at Module.load (internal/modules/cjs/loader.js:986:32)
at Function.Module._load (internal/modules/cjs/loader.js:879:14)
at Module.require (internal/modules/cjs/loader.js:1026:19)
at require (internal/modules/cjs/helpers.js:72:18) {
errno: -2,
syscall: 'open',
code: 'ENOENT',
path: '.env'
}

/home/ubuntu/shiny-auth0/node_modules/passport-auth0/lib/index.js:36
throw new Error('You must provide the ' + k + ' configuration value to use passport-auth0.');
^

Error: You must provide the domain configuration value to use passport-auth0.
at /home/ubuntu/shiny-auth0/node_modules/passport-auth0/lib/index.js:36:13
at Array.forEach ()
at new Strategy (/home/ubuntu/shiny-auth0/node_modules/passport-auth0/lib/index.js:34:20)
at Object. (/home/ubuntu/shiny-auth0/app.js:27:16)
at Module._compile (internal/modules/cjs/loader.js:1138:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
at Module.load (internal/modules/cjs/loader.js:986:32)
at Function.Module._load (internal/modules/cjs/loader.js:879:14)
at Module.require (internal/modules/cjs/loader.js:1026:19)
at require (internal/modules/cjs/helpers.js:72:18)

Could you help with this matter? I noticed that someone was also experiencing the same problem after setup.

Dockerize

This could be really useful Auth0 Proxy that some one can just use.

HA Documentation

Hello!

Does this code currently support HA architectures? If so, is there any documentation outlining the approach please?

I am running this code within a docker container, which is also where the state of the service is stored, in memory. If I restart the container, all connections are lost, which means using this in production would force all users to start a new session every time we would want to change the code.

Shiny Server using Auth0: 404 error

I have an ubuntu server running shiny server + nginx.

I followed this tutorial to protect access to it by using Auth0.

Now, when I navigate to "example.com/" I get a login page, and when logging in I get the shiny server welcome page.

However, when I try to access any of my specific apps ("example.com/appName"), I get a 404 Not Found error.

This is all that is printed in the screen:

Not Found
404
Error: Not Found
at /home/ubuntu/shiny-auth0/app.js:75:13
at Layer.handle [as handle_request] (/home/ubuntu/shiny-auth0/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/home/ubuntu/shiny-auth0/node_modules/express/lib/router/index.js:317:13)
at /home/ubuntu/shiny-auth0/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/home/ubuntu/shiny-auth0/node_modules/express/lib/router/index.js:335:12)
at next (/home/ubuntu/shiny-auth0/node_modules/express/lib/router/index.js:275:10)
at urlencodedParser (/home/ubuntu/shiny-auth0/node_modules/body-parser/lib/types/urlencoded.js:91:7)
at Layer.handle [as handle_request] (/home/ubuntu/shiny-auth0/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/home/ubuntu/shiny-auth0/node_modules/express/lib/router/index.js:317:13)
at /home/ubuntu/shiny-auth0/node_modules/express/lib/router/index.js:284:7

How can I solve this and access the apps?

Thanks!

Tweaks for RStudio Server Open-Source?

I'm applying the code in this repository to successfully use auth0 as the reverse proxy for Shiny Server. Works like a charm. Are there any modifications necessary to make it work with RStudio Server (the open-source version)? Obviously, the SHINY_PORT environment variable would need to change, to reflect the port where the RStudio Server listens, but is there anything else? For example, is the "/reports" route somehow specific to Shiny Server?

Thanks,
Justin

Integrate auto-login if user already authenticated by Auth0 client

How to add support for SSO while logging in?
Basically making auth0.js check if the user is already logged in through SSO. If the user is not logged in then redirect to the embedded login page.

Example: If Auth0 was used to login to another site, then make login automatic on the embedded login page.

Another solution to this is to have shiny-auth0 use central login rather than embedded login?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.