React Sanctum

screenshot of React Sanctum
laravel
react

Easily hook up your React app to Laravel Sanctum and Laravel Fortify

Overview

The React Sanctum package simplifies the integration of authentication in your React applications using Laravel Sanctum. This package effortlessly connects your React front-end to Laravel's back-end, allowing developers to manage authentication seamlessly. With built-in support for two-factor authentication via Laravel Fortify, it caters to modern security needs while keeping the setup straightforward.

What makes React Sanctum particularly appealing is its support for both hooks and class components, ensuring flexibility regardless of your preferred coding style. With just a single dependency on axios, it streamlines the process further, making the authentication experience efficient and user-friendly.

Features

  • Easy Integration: Connect your React app to Laravel Sanctum with minimal setup needed.
  • Supports Hooks & Class Components: Use the useSanctum hook or withSanctum higher-order component for versatile component integration.
  • User Authentication Data: Access real-time user data and authentication status through the Sanctum context.
  • SignIn/SignOut Methods: Built-in methods simplify user sign-in and sign-out processes, returning promises for seamless handling.
  • Two-Factor Authentication: Out-of-the-box support for two-factor authentication utilizing Laravel Fortify to enhance security.
  • Automatic Authentication Check: The package automatically checks if a user is signed in during the mounting of the <Sanctum> component.
  • Manual Control Option: If preferred, you can disable automatic authentication checks and manage it manually through the provided functions.
  • Ease of Axios Usage: Leverages axios for server requests, simplifying HTTP interactions in your React application.
laravel
Laravel

Laravel is a powerful and elegant PHP framework that provides developers with a comprehensive set of tools and features to build robust web applications. It follows the Model-View-Controller (MVC) architectural pattern, offering a clean and organized structure for writing efficient and maintainable code.

react
React

React is a widely used JavaScript library for building user interfaces and single-page applications. It follows a component-based architecture and uses a virtual DOM to efficiently update and render UI components

rollup
Rollup

RollupJS is a popular and efficient JavaScript module bundler that takes the code from multiple modules and packages them into a single optimized file, minimizing the overall size of the application and improving its performance.

typescript
Typescript

TypeScript is a superset of JavaScript, providing optional static typing, classes, interfaces, and other features that help developers write more maintainable and scalable code. TypeScript's static typing system can catch errors at compile-time, making it easier to build and maintain large applications.