npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ahmed_elssamman/auth-lib

v1.1.2

Published

⚡ A powerful, lightweight Angular 21 authentication library featuring seamless Login, Registration, OTP Email Verification, Password Reset, and Response Adapters.

Readme

🔐 @ahmed_elssamman/auth-lib

Angular Version License: MIT TypeScript RxJS

⚡ A modern, lightweight, and signal-ready Angular 21 Authentication Library
Designed for robust enterprise login, registration workflows, OTP email verification, password resets, and flexible data adaptation.

FeaturesInstallationQuick StartAPI ReferenceConfiguration


✨ Key Features

  • 🔑 Complete Auth Lifecycle: Out-of-the-box support for Login, Register, Password Reset, and OTP Verification.
  • 📩 OTP Email Verification: Built-in 2-step email verification workflow.
  • 🔄 Data Adaptation: Integrated AuthAdapterService to transform raw backend HTTP responses into standardized client models.
  • Angular 21 & Signals Ready: Built for modern Angular standalone components and Signal Forms.
  • 🎯 Custom Endpoint Overrides: Pass custom backend endpoints on a per-method basis without changing global config.
  • 🛡️ Type-Safe Interfaces: Fully typed request and response payloads with strict TypeScript definitions.

📦 Installation

Install the package via npm:

npm install @ahmed_elssamman/auth-lib

🚀 Quick Start

1. Provide API Configuration

In your app.config.ts or main application providers, register the API_CONFIG provider:

import { ApplicationConfig } from '@angular/core';
import { provideHttpClient } from '@angular/common/http';
import { API_CONFIG } from '@ahmed_elssamman/auth-lib';

export const appConfig: ApplicationConfig = {
  providers: [
    provideHttpClient(),
    {
      provide: API_CONFIG,
      useValue: {
        baseUrl: 'https://api.yourdomain.com/api/v1',
        clientName: 'Name-App',
      },
    },
  ],
};

2. Inject and Use AuthLib

Inject AuthLib into your component or feature service:

import { Component, inject } from '@angular/core';
import { AuthLib, IAuthLoginRequest } from '@ahmed_elssamman/auth-lib';
import { Router } from '@angular/router';

@Component({
  selector: 'app-login',
  standalone: true,
  templateUrl: './login.component.html',
})
export class LoginComponent {
  private readonly authLib = inject(AuthLib);
  private readonly router = inject(Router);

  onLogin(credentials: IAuthLoginRequest): void {
    this.authLib.login(credentials).subscribe({
      next: (adaptedResponse) => {
        console.log('Login Successful:', adaptedResponse.token, adaptedResponse.user);
        this.router.navigate(['/dashboard']);
      },
      error: (err) => console.error('Login Failed:', err),
    });
  }
}

📚 API Reference

AuthLib Methods

| Method | Parameters | Description | Returns | | :--- | :--- | :--- | :--- | | login | userData: IAuthLoginRequest, customEndpoint?: string | Authenticates user credentials and adapts token & user data. | Observable<IAuthAdaptedResponse> | | register | userData: Partial<IAuthRegisterInterface>, customEndpoint?: string | Registers a new user account. | Observable<IAuthAdaptedResponse> | | sendEmailForVerification | email: string, customEndpoint?: string | Triggers an OTP verification email to the user. | Observable<any> | | verifyEmail | userData: { email: string; code: string }, customEndpoint?: string | Validates the OTP code received via email. | Observable<any> | | forgotPassword | userData: { email: string; redirectUrl?: string }, customEndpoint?: string | Initiates password recovery process. | Observable<any> | | resetPassword | userData: { token: string; newPassword: string; confirmPassword: string }, customEndpoint?: string | Sets a new password using reset token. | Observable<any> |


🛠️ Advanced Customization

[!TIP] Overriding Endpoints Dynamically
If your API has custom routes for specific features (e.g. /v2/auth/quick-login), you can pass a custom endpoint string directly to any method call:

this.authLib.login(credentials, '/v2/auth/quick-login').subscribe(...);

[!NOTE] Data Adapter pattern
By default, login() and register() pipe response data through AuthAdapterService. This normalizes user objects, status codes, and JWT tokens across varying backend API response shapes.


📄 License

Distributed under the MIT License. See LICENSE for more information.