@smess/auth-plugin
v1.0.1
Published
Authentication plugin for SMESS platform with React components and services.
Maintainers
Readme
@smess/auth-plugin
A comprehensive authentication plugin for SMESS platform with React components and services.
Features
- 🔐 Complete authentication flow (login, register, forgot password, OTP)
- ⚛️ Ready-to-use React components with shadcn/ui styling
- 🛡️ Route protection with AuthGuard component
- 📱 User profile management
- 🔧 Configurable authentication services
- 🎨 Beautiful UI components built with Radix UI and Tailwind CSS
Installation
npm install @smess/auth-pluginQuick Start
import React from 'react';
import { AuthPlugin, LoginForm, AuthGuard } from '@smess/auth-plugin';
const config = {
baseUrl: 'https://api.example.com',
clientId: 'your-client-id',
apiKey: 'your-api-key',
};
const authPlugin = new AuthPlugin(config);
function App() {
return (
<AuthGuard authPlugin={authPlugin}>
<LoginForm authPlugin={authPlugin} />
</AuthGuard>
);
}Components
AuthPlugin
Main authentication service class that handles all auth operations.
React Components
LoginForm- Login form with validationRegisterForm- User registration formForgotPasswordForm- Password reset formOTPForm- OTP verification formUserProfile- User profile displayAuthGuard- Route protection wrapper
Services
AuthService- Core authentication logicTokenService- Token managementStorageService- Local storage handlingApiService- API communicationEventService- Authentication events
Configuration
interface AuthConfig {
baseUrl: string;
clientId: string;
apiKey: string;
isProd?: boolean;
}Development
# Install dependencies
npm install
# Build the library
npm run build
# Run tests
npm test
# Lint code
npm run lint
# Format code
npm run formatPublishing
# Build and publish to npm
npm run publish:libLicense
MIT
Support
For support and questions, please refer to the SETUP.md file for detailed usage instructions.
