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

@lissa-ems/auth-service

v1.1.1

Published

Centralized authentication service for LISSA apps

Readme

@lissa-ems/auth-service

Centralized cross-app logout service for LISSA Angular applications.

Installation

npm install @lissa-ems/auth-service

Usage

Angular 9-15 (Module-based)

1. Configure in app.module.ts

import { NgModule } from '@angular/core';
import { LissaAuthService, AUTH_CONFIG } from '@lissa-ems/auth-service';

@NgModule({
  providers: [
    {
      provide: AUTH_CONFIG,
      useValue: {
        authUrl: 'https://auth.example.com'
      }
    },
    {
      provide: LissaAuthService,
      useFactory: (config: any) => new LissaAuthService(config),
      deps: [AUTH_CONFIG]
    }
  ]
})
export class AppModule { }

2. Use in app.component.ts

import { Component, OnInit } from '@angular/core';
import { LissaAuthService } from '@lissa-ems/auth-service';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html'
})
export class AppComponent implements OnInit {
  constructor(private lissaAuth: LissaAuthService) {}

  ngOnInit() {
    this.lissaAuth.startSessionCheck();
  }
}

Angular 16+ (Standalone)

1. Configure in app.config.ts

import { ApplicationConfig } from '@angular/core';
import { AUTH_CONFIG, LissaAuthService } from '@lissa-ems/auth-service';

export const appConfig: ApplicationConfig = {
  providers: [
    {
      provide: AUTH_CONFIG,
      useValue: {
        authUrl: 'https://auth.example.com'
      }
    },
    {
      provide: LissaAuthService,
      useFactory: (config: any) => new LissaAuthService(config),
      deps: [AUTH_CONFIG]
    }
  ]
};

2. Use in app.component.ts

import { Component, OnInit, inject } from '@angular/core';
import { LissaAuthService } from '@lissa-ems/auth-service';

@Component({
  selector: 'app-root',
  standalone: true,
  templateUrl: './app.component.html'
})
export class AppComponent implements OnInit {
  private lissaAuth = inject(LissaAuthService);

  ngOnInit() {
    this.lissaAuth.startSessionCheck();
  }
}

Common Usage in Components

import { Component } from '@angular/core';
import { LissaAuthService } from '@lissa-ems/auth-service';

@Component({
  selector: 'app-navbar',
  template: `
    <button *ngIf="isLoggedIn()" (click)="logout()">Logout</button>
  `
})
export class NavbarComponent {
  constructor(private lissaAuth: LissaAuthService) {}

  logout() {
    this.lissaAuth.logout().subscribe();
  }

  isLoggedIn(): boolean {
    return this.lissaAuth.isAuthenticated();
  }

  getCurrentUser() {
    return this.lissaAuth.getUser();
  }
}

Auth App Configuration

In your centralized authentication app, add logout detection:

// auth-app/app.component.ts
export class AppComponent implements OnInit {
  constructor(private lissaAuth: LissaAuthService) {}

  ngOnInit() {
    // Handle logout from other apps
    this.lissaAuth.handleLogoutFromOtherApp();
    
    // Start session monitoring
    this.lissaAuth.startSessionCheck();
  }
}

API Reference

Methods

| Method | Description | Returns | |--------|-------------|----------| | logout() | Logout user and redirect to auth app | Observable<any> | | startSessionCheck(intervalMs?) | Start monitoring for cross-app logout | void | | stopSessionCheck() | Stop session monitoring | void | | isAuthenticated() | Check if user is logged in | boolean | | getUser() | Get current user data | CurrentUser \| null | | getAccessToken() | Get current access token | string \| null | | checkTokenValidity() | Validate current token | Observable<any> | | handleLogoutFromOtherApp() | Handle logout from other apps (auth app only) | void |

Configuration

| Property | Type | Description | |----------|------|-------------| | authUrl | string | URL of your centralized authentication app |

Features

  • Cross-app logout: Logout from one app logs out all apps
  • Session monitoring: Automatic token validation and logout detection
  • Angular compatibility: Supports Angular 9.x through 21.x
  • Simple setup: Only requires auth app URL configuration
  • Lightweight: No external dependencies beyond Angular and RxJS

How It Works

  1. User logs out: Any app calls logout() method
  2. Session cleared: localStorage and sessionStorage are cleared
  3. Redirect to auth app: User is redirected to auth app with ?logout=true
  4. Auth app logout: Auth app detects parameter and performs complete logout
  5. Cross-app detection: Other apps detect missing session via polling and auto-logout

Requirements

  • Angular 9.x - 21.x
  • RxJS 6.x - 8.x
  • User data stored in localStorage as current_user with accessToken property