Coder Social home page Coder Social logo

dash-okta-auth's People

Contributors

fspijkerman avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

dash-okta-auth's Issues

enabling redirect to login while is already loaded

currently, if a user has logged in okta but his session has expired, the dash app is not updated anymore as the calls to /_dash-... are receiving a redirect (302) they cannot manage.
I have hacked the following solution that appears to work:

  1. add an element of type dcc.Location(refresh=True, id="URL_OUT"), in the app layout
  2. trigger a change on this element when Dash is sending a /_dash-update-component and the session is not authorized. For this, change in the "login_request" (https://github.com/fspijkerman/dash-okta-auth/blob/master/dash_okta_auth/okta_oauth.py#L45) from
    def login_request(self):
        # send to okta auth page
        return redirect(url_for("okta.login"))

to

    def login_request(self):
        # send to okta auth page
        if request.path.startswith("/_dash-update-component"):
            import json
            return json.dumps({"response": {"URL_OUT": {"href": "http://127.0.0.1:8051/login/okta"}}, "multi": True})
        return redirect(url_for("okta.login"))

Today, the ID of the dcc.Location is hardcoded but it could be passed as a configuration parameter.

Is this a reasonable fix ?

calling okta.get("/oauth2/default/v1/userinfo") on every call ?

I have the impression the library will, on every request, the wrapper calls is_authorized which calls self.okta.session.get(f'{self.base_url}/userinfo') (https://github.com/fspijkerman/dash-okta-auth/blob/master/dash_okta_auth/okta_oauth.py#L37) to retrieve the 'email' of the user. Is that correct ?

If so, it adds latency to each call just to get the email which is often already available in the JWT.
Is it possible to disable this call ?

TypeError: Dash() got an unexpected keyword argument 'auth'

i'm using a virtual env and installing from the requirements.txt file.

application will run if i remove auth='auth' but then I get an error from Okta:

"Description: The 'redirect_uri' parameter must be an absolute URI that is whitelisted in the client app settings."

I'm following https://github.com/okta/samples-python-flask/tree/master/okta-hosted-login
to set up the app on Okta (only difference a use of port 8050 for call back). The link to okta set up for flask-dance does not work btw.

any ideas?

thanks!!

flask_dance removed okta provider

The okta provider was removed in flask_dance. I was able to reuse most of your code replacing okta using the OAuth2ConsumerBlueprint.
You can find my demo application here: github.com/nicohein/dash-okta-oauth2
Let me know if you are interested in a pull request for your project. I haven't forked your project yet because I used a slightly different structure.

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.