Authentication with Laravel Sanctum
This package connects a Laravel Sanctum backend to a React Native app. It provides functions for signing in, signing out, accessing the current user and checking authentication state.
Using it in an app
An AuthProvider wraps the application. Components access authentication functions and user state through useAuth.
import { AuthProvider, useAuth } from 'react-native-laravel-sanctum';
API endpoints are configured in the provider. The backend needs to provide the corresponding sign-in, sign-out and user endpoints.
Installation
npm install react-native-laravel-sanctum
The package uses expo-secure-store and therefore requires a new native app build. The README includes setup instructions and an example app.