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

@logto/angular

v2.1.2

Published

The Logto SDK for Angular applications. It is built on `@logto/browser` and exposes Angular-native dependency injection and Signals.

Readme

Logto Angular SDK

The Logto SDK for Angular applications. It is built on @logto/browser and exposes Angular-native dependency injection and Signals.

Installation

pnpm add @logto/angular

Configuration

Register Logto in the application config:

import { type ApplicationConfig } from '@angular/core';
import { provideRouter } from '@angular/router';
import { provideLogto, UserScope } from '@logto/angular';

import { routes } from './app.routes';

export const appConfig: ApplicationConfig = {
  providers: [
    provideLogto(
      {
        endpoint: 'https://your-tenant.logto.app',
        appId: 'your-app-id',
        scopes: [UserScope.Email, UserScope.Organizations],
        resources: ['https://api.example.com'],
      },
      { enableCache: true }
    ),
    provideRouter(routes),
  ],
};

OIDC discovery caching is disabled by default. The deprecated unstable_enableCache option remains supported, and enableCache takes precedence when both are provided.

Sign in and sign out

Inject LogtoService and read its Signals directly from the template:

import { Component, inject } from '@angular/core';
import { LogtoService } from '@logto/angular';

@Component({
  selector: 'app-root',
  template: `
    @if (logto.isLoading()) {
    <p>Loading…</p>
    } @else if (logto.isAuthenticated()) {
    <button type="button" (click)="signOut()">Sign out</button>
    } @else {
    <button type="button" (click)="signIn()">Sign in</button>
    }
  `,
})
export class AppComponent {
  readonly logto = inject(LogtoService);

  async signIn() {
    await this.logto.signIn({
      redirectUri: `${window.location.origin}/callback`,
      postRedirectUri: window.location.origin,
    });
  }

  async signOut() {
    await this.logto.signOut(window.location.origin);
  }
}

Handle the callback

Register a dedicated callback route and complete the sign-in flow after browser rendering:

import { afterNextRender, Component, inject } from '@angular/core';
import { LogtoService } from '@logto/angular';

@Component({
  standalone: true,
  template: '<p>Completing sign-in…</p>',
})
export class CallbackComponent {
  private readonly logto = inject(LogtoService);

  constructor() {
    afterNextRender(() => {
      void (async () => {
        const callbackUri = window.location.href;

        if (await this.logto.isSignInRedirected(callbackUri)) {
          await this.logto.handleSignInCallback(callbackUri);
        }
      })().catch(() => undefined);
    });
  }
}

LogtoService also exposes resource-aware access tokens, organization tokens, ID-token claims, userinfo, token clearing, and an error Signal. See the Angular sample for a complete integration.

Server-side rendering

Authentication state is restored from browser storage after the first browser render. Tokens are not exposed during server rendering. Use a server or BFF SDK when authenticated data is required while rendering on the server.

Migrating from v1

Version 2 replaces the angular-auth-oidc-client configuration helper with a first-party Logto SDK:

  • Replace provideAuth({ config: buildAngularAuthConfig(...) }) with provideLogto(...).
  • Replace OidcSecurityService with LogtoService.
  • Pass redirect URIs to signIn() and signOut() instead of provider configuration.
  • Add a callback route that calls handleSignInCallback().
  • Read isLoading(), isAuthenticated(), and error() Signals instead of subscribing to checkAuth().

Version 1 accepted only one resource string. Applications that needed multiple resources sometimes used a comma-separated workaround:

buildAngularAuthConfig({
  // ...
  resource: 'com.company.resource1,com.company.resource2',
});

Version 2 supports the Logto resource array directly. Replace the workaround with separate array entries:

provideLogto({
  // ...
  resources: ['com.company.resource1', 'com.company.resource2'],
});

Existing third-party session data is not migrated; users need to sign in once after upgrading.