0.2.11 • Published 6 months ago

@explita/u-auth v0.2.11

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

u-auth - Simplified Authentication for React

A lightweight authentication library for React applications. Provides utilities to handle common authentication tasks like managing authentication tokens, verifying sessions, handling cookies, and supporting both OTP and token-based authentication.

✨ Features

  • 📱 OTP-based login support
  • 🔐 JWT token session handling
  • ⚛️ React hooks for seamless UX
  • 💼 Works with Next.js API and server functions
  • 💅 Minimal styles with Tailwind support

🚀 Installation

npm install @explita/u-auth

or

yarn add @explita/u-auth

or

pnpm add @explita/u-auth

Make sure you also have these as peer dependencies:

npm install react react-dom

Add the CSS

import '@explita/u-auth/styles.css';

📜 Session Management

The u-auth library handles session management by automatically storing and retrieving authentication tokens using HTTP-only cookies for better security.

Authentication tokens are stored in cookies, with the HttpOnly flag to prevent JavaScript access.

The useAuth hook allows easy access to session data in any component.


🔐 Authentication Methods

Token-Based Authentication

Use JWT tokens for stateless authentication. The library provides helpers to manage tokens and sessions using cookies.

OTP-Based Authentication

You can implement OTP-based authentication by using the OTPProvider, OTPInput and useOTP hook. This is ideal for scenarios where you want to verify users via an OTP sent to their email or phone.


📄 License

MIT — Made with ❤️ by Explita

0.2.11

6 months ago

0.2.10

7 months ago

0.2.9

7 months ago

0.2.8

7 months ago

0.2.7

7 months ago

0.2.6

8 months ago

0.2.5

8 months ago

0.2.4

8 months ago

0.2.3

8 months ago

0.2.2

8 months ago

0.2.1

8 months ago

0.2.0

8 months ago

0.1.0

8 months ago