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

@wocha/angular

v0.1.0

Published

Wocha authentication for Angular applications

Readme

@wocha/angular

Angular service, guard, and callback component for Wocha authentication in single-page applications. Implements the OAuth 2.0 authorisation code flow with PKCE as a public client — no client secret required.

Install

npm install @wocha/angular
# or: pnpm add / yarn add @wocha/angular

Peer dependencies: Angular 17+, @angular/router, and RxJS 7+.

Quick start

Import WochaAuthModule.forRoot() in your app module and register a /callback route:

// app.config.ts or app.module.ts
import { WochaAuthModule } from "@wocha/angular";

WochaAuthModule.forRoot({
  issuer: "https://my-tenant.auth.wocha.ai",
  clientId: "your-client-id",
  redirectUri: window.location.origin + "/callback",
});
// app.routes.ts
import { GreetCallbackComponent, wochaAuthGuard } from "@wocha/angular";

export const routes = [
  { path: "callback", component: GreetCallbackComponent },
  { path: "dashboard", canActivate: [wochaAuthGuard], loadComponent: () => import("./dashboard") },
];

Register your redirect URI (https://your-app.com/callback) in the Wocha Console before testing.

Configuration reference

| Field | Type | Required | Description | |-------|------|----------|-------------| | issuer | string | Yes | OIDC issuer URL (e.g. https://my-tenant.auth.wocha.ai). | | clientId | string | Yes | OAuth client ID for your SPA application. | | redirectUri | string | No | Callback URL. Defaults to {origin}/callback. | | scopes | string | No | Space-separated scopes. Default: openid profile email offline_access. | | audience | string | No | API audience claim, if your tenant requires it. | | platformApiUrl | string | No | Platform API base URL for permission checks. |

WochaAuthService

Inject WochaAuthService for reactive auth state and imperative actions:

import { Component, inject, OnInit } from "@angular/core";
import { WochaAuthService } from "@wocha/angular";

@Component({ /* ... */ })
export class HeaderComponent implements OnInit {
  private auth = inject(WochaAuthService);

  user$ = this.auth.user$;
  isAuthenticated$ = this.auth.isAuthenticated$;

  ngOnInit() {
    this.auth.restore();
  }

  signIn() {
    this.auth.signIn();
  }

  signOut() {
    this.auth.signOut();
  }
}

Route protection

Use the functional wochaAuthGuard or class-based WochaAuthGuard on protected routes. Unauthenticated users are redirected to /login.

Security model

  • Public client (PKCE): No client secret in the browser. Suitable for SPAs only.
  • Token storage: Access and refresh tokens are stored in sessionStorage (cleared when the tab closes).
  • No server-side session: Use @wocha/nextjs or @wocha/sveltekit for BFF patterns with httpOnly cookies.

Related packages

| Package | Use when | |---------|----------| | @wocha/vue | Vue 3 SPA with the same PKCE flow | | @wocha/react | React SPA with the same PKCE flow | | @wocha/nextjs | Next.js App Router with server-side sessions | | @wocha/sdk | Server-side user/org management via the Management API |

Troubleshooting

redirect_uri_mismatch

The redirectUri must exactly match a redirect URI registered in the Wocha Console.

CSRF / state_mismatch

Clear site storage for your origin and retry. Do not start a second login flow before the first completes.