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

@authaction/web-sdk

v0.1.8

Published

AuthAction OAuth2 client SDK for web — framework agnostic, with React, Angular, Vue, and Next.js bindings

Readme

@authaction/web-sdk

Browser-side OAuth2 / PKCE SDK for AuthAction. Framework-agnostic core with first-class wrappers for React, Next.js, Angular, Vue 3, and Vanilla JS.

Installation

npm install @authaction/web-sdk

Frameworks

| Import path | Framework | |---|---| | @authaction/web-sdk | Vanilla JS / TypeScript | | @authaction/web-sdk/react | React 17+ | | @authaction/web-sdk/nextjs | Next.js 14+ (App Router, client-side) | | @authaction/web-sdk/angular | Angular 17+ | | @authaction/web-sdk/vue | Vue 3 |


React

// main.tsx
import { AuthActionProvider } from '@authaction/web-sdk/react';

<AuthActionProvider
  domain="myapp.eu.authaction.com"
  clientId="your-client-id"
  redirectUri={`${window.location.origin}/`}
  postLogoutRedirectUri={`${window.location.origin}/`}
  authorizationParams={{ audience: 'https://api.myapp.com' }}
>
  <App />
</AuthActionProvider>
// App.tsx
import { useAuthAction, hasAuthParams } from '@authaction/web-sdk/react';

function App() {
  const { isLoading, isAuthenticated, user, loginWithRedirect, logout } = useAuthAction();

  if (isLoading) return <Spinner />;
  if (!isAuthenticated) return <button onClick={() => loginWithRedirect()}>Login</button>;
  return (
    <div>
      <p>Hello {user?.name}</p>
      <button onClick={() => logout()}>Logout</button>
    </div>
  );
}

react-oidc-context compatibility

The SDK is a drop-in replacement for react-oidc-context. The following are provided for compatibility:

| react-oidc-context | @authaction/web-sdk/react | |---|---| | useAuth() | useAuthAction() | | auth.signinRedirect() | auth.loginWithRedirect() | | auth.signoutRedirect() | auth.logout() | | auth.removeUser() | auth.removeUser() ✓ same | | auth.user?.access_token | auth.user?.access_token ✓ same | | auth.user?.profile.* | auth.user?.profile.* ✓ same | | auth.activeNavigator | auth.activeNavigator ✓ same | | hasAuthParams() | hasAuthParams() ✓ same |


Next.js (App Router)

// app/layout.tsx
import { AuthActionNextProvider } from '@authaction/web-sdk/nextjs';

export default function RootLayout({ children }) {
  return (
    <html><body>
      <AuthActionNextProvider
        domain="myapp.eu.authaction.com"
        clientId="your-client-id"
        redirectUri="http://localhost:3000/"
      >
        {children}
      </AuthActionNextProvider>
    </body></html>
  );
}
// Any client component
'use client';
import { useAuthAction } from '@authaction/web-sdk/nextjs';

export function Profile() {
  const { user, logout } = useAuthAction();
  return <button onClick={() => logout()}>{user?.name}</button>;
}

For server-side sessions (NextAuth.js pattern) use @authaction/server-sdk/nextjs instead.


Angular

// main.ts
import { provideAuthAction } from '@authaction/web-sdk/angular';

bootstrapApplication(AppComponent, {
  providers: [
    provideAuthAction({
      domain: 'myapp.eu.authaction.com',
      clientId: 'your-client-id',
      redirectUri: 'http://localhost:4200/',
    }),
  ],
});
// app.component.ts
import { AuthActionService } from '@authaction/web-sdk/angular';

@Component({ ... })
export class AppComponent {
  constructor(public auth: AuthActionService) {}

  login()  { this.auth.loginWithRedirect(); }
  logout() { this.auth.logout(); }
}
<ng-container *ngIf="auth.isAuthenticated$ | async">
  Welcome {{ (auth.user$ | async)?.name }}
</ng-container>

Route guard

// app.routes.ts
{ path: 'dashboard', canActivate: [authActionGuard], component: DashboardComponent }

Vue 3

// main.ts
import { createApp } from 'vue';
import { createAuthAction } from '@authaction/web-sdk/vue';

const app = createApp(App);
app.use(createAuthAction({
  domain: 'myapp.eu.authaction.com',
  clientId: 'your-client-id',
  redirectUri: 'http://localhost:5173/callback',
}));
app.mount('#app');
<script setup lang="ts">
import { useAuthAction } from '@authaction/web-sdk/vue';

const { state, loginWithRedirect, logout } = useAuthAction();
</script>

<template>
  <div v-if="state.isAuthenticated">
    Hello {{ state.user?.name }}
    <button @click="logout()">Logout</button>
  </div>
  <button v-else @click="loginWithRedirect()">Login</button>
</template>

Vanilla JS / TypeScript

import { AuthActionClient } from '@authaction/web-sdk';

const client = new AuthActionClient({
  domain: 'myapp.eu.authaction.com',
  clientId: 'your-client-id',
  redirectUri: 'http://localhost:5173/callback',
});

// Login
await client.loginWithRedirect();

// Handle callback (call on your redirect URI page)
await client.handleRedirectCallback();

// Get access token (auto-refreshes if expired)
const token = await client.getAccessToken();

// Logout
await client.logout({ returnTo: 'http://localhost:5173' });

Configuration

| Option | Type | Required | Description | |---|---|---|---| | domain | string | ✓ | AuthAction tenant domain | | clientId | string | ✓ | OAuth2 client ID | | redirectUri | string | ✓ | Callback URL after login | | postLogoutRedirectUri | string | | Redirect URL after logout | | scope | string | | OAuth2 scopes (default: openid profile email) | | authorizationParams | object | | Extra params forwarded to /authorize (e.g. audience) | | cacheLocation | memory | localstorage | sessionstorage | | Token storage (default: memory) |

Environment variables

AUTHACTION_DOMAIN=your-tenant.eu.authaction.com
AUTHACTION_CLIENT_ID=your-client-id
AUTHACTION_REDIRECT_URI=http://localhost:3000/
AUTHACTION_AUDIENCE=https://api.your-app.com

License

MIT