Gathering detailed insights and metrics for goobs-auth
Gathering detailed insights and metrics for goobs-auth
Gathering detailed insights and metrics for goobs-auth
Gathering detailed insights and metrics for goobs-auth
goobs-frontend
A comprehensive React-based libary that extends the functionality of Material-UI
goobs-next-auth
goobs-repo is a collection of reusable components and utilities for building web applications with React and Next.js. It provides a set of tools to streamline development and enhance functionality.
A comprehensive and customizable authentication solution for applications. Includes flexible auth flows, email/SMS verification, custom middleware, and integration with Twilio and SMTP services.
npm install goobs-auth
Typescript
Module System
Node Version
NPM Version
TypeScript (99.78%)
JavaScript (0.22%)
Verify real, reachable, and deliverable emails with instant MX records, SMTP checks, and disposable email detection.
Total Downloads
686
Last Day
3
Last Week
5
Last Month
32
Last Year
686
MIT License
1 Stars
126 Commits
1 Watchers
1 Branches
1 Contributors
Updated on Aug 26, 2024
Latest Version
0.3.0
Package Id
goobs-auth@0.3.0
Unpacked Size
101.33 kB
Size
21.29 kB
File Count
26
NPM Version
9.7.1
Node Version
21.7.3
Published on
Aug 16, 2024
Cumulative downloads
Total Downloads
Last Day
200%
3
Compared to previous day
Last Week
0%
5
Compared to previous week
Last Month
-22%
32
Compared to previous month
Last Year
0%
686
Compared to previous year
18
The NPM repo is available here - https://www.npmjs.com/package/goobs-auth
goobs-auth is a comprehensive authentication solution for Next.js applications. It provides a flexible and customizable authentication flow that can be easily integrated into your projects.
To install goobs-auth in your Next.js project, run one of the following commands:
1npm install goobs-auth 2# or 3yarn add goobs-auth
next.config.js
:1/** @type {import('next').NextConfig} */ 2const nextConfig = { 3 reactStrictMode: true, 4 swcMinify: true, 5 transpilePackages: ['goobs-frontend', 'goobs-cache', 'goobs-auth', 'goobs-encryption'], 6}; 7 8export default nextConfig;
.auth.json
) in your project root:1{ 2 "userModel": { 3 "getUser": { 4 "path": "./path/to/getUserFunction", 5 "exportName": "getUser" 6 }, 7 "setUser": { 8 "path": "./path/to/setUserFunction", 9 "exportName": "setUser" 10 }, 11 "deleteUser": { 12 "path": "./path/to/deleteUserFunction", 13 "exportName": "deleteUser" 14 } 15 }, 16 "database": { 17 "connectScript": "// Your database connection script" 18 }, 19 "authentication": { 20 "login": [ 21 { "step": 1, "type": "enterEmail" }, 22 { "step": 2, "type": "emailAndPasswordVerification" } 23 ], 24 "registration": [ 25 { "step": 1, "type": "enterEmail" }, 26 { "step": 2, "type": "emailAndPasswordAndVerifyPasswordVerification" }, 27 { "step": 3, "type": "emailVerification" }, 28 { "step": 4, "type": "textMessageVerification" }, 29 { "step": 5, "type": "accountInfo" } 30 ], 31 "forgotPassword": [ 32 { "step": 1, "type": "enterEmail" }, 33 { "step": 2, "type": "emailVerification" } 34 ] 35 }, 36 "twilio": { 37 "accountSid": "your_twilio_account_sid", 38 "authToken": "your_twilio_auth_token", 39 "phoneNumber": "your_twilio_phone_number" 40 }, 41 "smtp": { 42 "host": "your_smtp_host", 43 "port": 587, 44 "secure": false, 45 "auth": { 46 "user": "your_smtp_username", 47 "pass": "your_smtp_password" 48 }, 49 "from": "noreply@yourdomain.com" 50 } 51}
1// pages/auth.tsx 2'use client'; 3 4import React from 'react'; 5import { AppRouterCacheProvider } from '@mui/material-nextjs/v14-appRouter'; 6import { AuthPageContent } from 'goobs-auth'; 7 8export default function AuthPage() { 9 return ( 10 <AppRouterCacheProvider> 11 <AuthPageContent /> 12 </AppRouterCacheProvider> 13 ); 14}
authMiddleware
:1// middleware.ts 2import { authMiddleware } from 'goobs-auth'; 3 4export default authMiddleware;
The .auth.json
file allows you to customize various aspects of the authentication flow:
userModel
: Define functions for user management (get, set, delete)database
: Specify the database connection scriptauthentication
: Configure the steps for login, registration, and password recoverytwilio
: Set up Twilio credentials for SMS servicessmtp
: Configure SMTP settings for email servicesloadAuthConfig(configPath?: string): Promise<AuthConfig>
Loads the authentication configuration from the specified path or the default locations.
authUtility(options: AuthUtilityOptions): Promise<ValidateResult | LoginResult | LogoutResult>
A comprehensive authentication utility for server components and server actions.
authSpoof(options?: AuthSpoofOptions): Promise<{ isValid: boolean, validTokens: ValidTokens }>
Generates mock authentication data for testing purposes.
goobs-auth provides several React components for building the authentication UI:
AuthPageContent
: The main authentication page componentEnterEmailStep
: Component for entering emailEmailPasswordVerificationStep
: Component for email and password verificationEmailVerificationStep
: Component for email verificationTextMessageVerificationStep
: Component for SMS verificationAccountInfoStep
: Component for collecting additional account informationgoobs-auth includes several server-side actions for handling authentication:
verifyEmail
: Verifies an email addresssendEmail
: Sends an email (e.g., for verification)sendSMS
: Sends an SMS messageverifyUser
: Verifies a user's phone numberThe authMiddleware
function can be used to protect routes and validate authentication tokens.
This project is licensed under the MIT License.
For questions, feature requests, or support, please contact:
For the quickest response, please use email. Our website is currently under development and will be shared here soon.
No vulnerabilities found.
No security vulnerabilities found.