Giter Site home page Giter Site logo

react-hooks-auth's Introduction

API Auth for Single Page Applications

Session-Based Auth vs Token-Based Auth

Implementing authorization and authentication into a full-stack application is a challenging process that will test your knowledge of frontend and backend code. If you decide you need to implement auth for your project, make sure you have a good understanding of the workflow, and work on implementing auth in a smaller project to get practice.

The two labs linked in this section discuss two alternative approaches to auth:

  • Session-based auth relies on Rails built-in session mechanism, similar to handling auth in Phase 2 Rails. Since it relies on cookies, session-based auth isn't a good choice for React Native projects.
  • JWT auth introduces a new technology, JSON Web Tokens, to handle authentication between the client and server. JWT auth does not rely on cookies, so it's a better choice for React Native projects. However, tokens need to be stored somewhere, and traditional options (localStorage or sessionStorage) are not secure - they can be accessed by XSS attacks.

Based on your project's needs, and your comfort level with auth in Rails, choose the strategy that is right for you!

Resources

react-hooks-auth's People

Contributors

ihollander avatar dependabot[bot] 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.