GithubHelp home page GithubHelp logo

next-iron-session's Introduction

  1. Run yarn
  2. Fill in .env.local
  3. Run yarn dev

A few points about the implementation:

  1. Time between a token expiring and the related cookie expiring was not specified, set it to 50% of the token expiration time. So if a token is valid for an hour the cookie will be valid for 1.5 hours to give the user some time to stumble upon a refresh
  2. Should everything taken from the API be rendered on the server? I provided both server-side checks and client-side checks. Server side checks make protected content stay on the page in other tabs on log out, client side checks can leverage SWR cache to hide protected content in every tab.
  3. I tried calling /o/revoke_token/ as per the docs https://django-oauth-toolkit.readthedocs.io/en/latest/tutorial/tutorial_04.html but it was not successful. That's why I created dummy endpoint for both revoking (making it invalid) and expiring (but it expires the cookie) the token.
  4. I implemented the app using oauth2-mock-server first. That's why there's an oauthCallback endpoint and an if statement in the login endpoint. I thought that it would be nice to leave them there and control the behaviour with the .env file

next-iron-session's People

Contributors

lukigarazus avatar

Watchers

 avatar

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.