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

speckle-auth

v0.0.8

Published

Utilities for authenticating with the Speckle.

Readme

Speckle Authentication Client 🔐

The Speckle Authentication Client makes it easy for web apps to log users into the Speckle platform. It supports two ways to log in: using an OAuth-based application login or a personal access token (PAT). 🌐✅🔑

Installation 🛠️

To install this package, run:

npm install speckle-auth

How to Use It 💡

Logging in with Application Credentials (OAuth) 🔑🌍🛠️

If you're using OAuth, you need a clientId and clientSecret to let users log in.

import { SpeckleAuthClient, type ApplicationOptions } from 'speckle-auth';

const options: ApplicationOptions = {
  clientId: 'your-client-id',
  clientSecret: 'your-client-secret',
  serverUrl: 'https://app.speckle.systems',
};
const speckle = new SpeckleAuthClient(options);

async function authenticateUser() {
  const user = await speckle.user();
  if (!user) {
    await speckle.login();
  }
  return user;
}

async function logoutUser() {
  await speckle.logout();
}

Storing Speckle Credentials in cookies

By default, Speckle credentials are stored in local storage. If you want to store them in cookies instead, you can set cookieAppDomain to the domain of your app. This is useful if you want to use the same Speckle credentials across multiple subdomains.

import { SpeckleAuthClient, type ApplicationOptions } from 'speckle-auth';

const options: ApplicationOptions = {
  clientId: 'your-client-id',
  clientSecret: 'your-client-secret',
  serverUrl: 'https://app.speckle.systems',
  cookieAppDomain: 'your-app-domain.com',
};

Logging in with a Personal Access Token (PAT) 🔒🛡️🔑

If you don't want to use OAuth, you can log in with a personal access token instead.

import {
  SpeckleAuthClient,
  type PersonalAccessTokenOptions,
} from 'speckle-auth';

const options: PersonalAccessTokenOptions = {
  serverUrl: 'https://app.speckle.systems',
  token: 'your-personal-access-token',
};
const speckle = new SpeckleAuthClient(options);

async function authenticateUser() {
  const user = await speckle.user();
  return user;
}

async function logoutUser() {
  await speckle.logout();
}

API Reference 📚

SpeckleAuthClient(options) 📝

Creates a new authentication client.

  • options: You can pass in either ApplicationOptions (for OAuth) or PersonalAccessTokenOptions (for PAT).

speckle.user() 👤🔍💾

Returns the logged-in user, or null if no one is logged in.

speckle.login() 🔑📲✅

Starts the login process for OAuth users. Note that the login will also handle the finish process of the login, when the user is redirected back from Speckle.

speckle.logout() 🚪🔒👋

Logs the user out.

speckle.token 🔑

Returns the current authentication token, or undefined if no token is available. Use it to make further requests to the Speckle API.

License 📜⚖️🔓

This package is available under the MIT License, so you can modify and share it as needed. 🎉📢💡