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

opensora-uaa-client

v1.0.1

Published

Universal Authentication & Authorization SDK for JavaScript/TypeScript

Readme

@opensora/uaa-client

Universal Authentication & Authorization Client SDK for JavaScript/TypeScript.

Installation

npm install @opensora/uaa-client

Usage

Initialize Client

import { UAAClient } from '@opensora/uaa-client';

const uaa = new UAAClient({
  projectId: 'your-project-id',  // Get this from UAA dashboard
  baseURL: 'https://auth.opensora.store/api/v1'  // Optional, default value
});

Google Sign In

<!-- Include Google SDK -->
<script src="https://accounts.google.com/gsi/client" async defer></script>

<div id="g_id_onload"
     data-client_id="YOUR_GOOGLE_CLIENT_ID"
     data-callback="handleGoogleCallback">
</div>
async function handleGoogleCallback(response) {
  try {
    const result = await uaa.loginWithGoogle(response.credential);

    // Store tokens
    localStorage.setItem('access_token', result.access_token);
    localStorage.setItem('refresh_token', result.refresh_token);

    console.log('Logged in user:', result.user);
  } catch (error) {
    console.error('Login failed:', error);
  }
}

Apple Sign In

<!-- Include Apple SDK -->
<script src="https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js"></script>
// Initialize Apple Sign In
AppleID.auth.init({
  clientId: 'YOUR_APPLE_CLIENT_ID',
  scope: 'name email',
  redirectURI: 'https://yourdomain.com/auth/callback',
  usePopup: true
});

// Handle login
async function handleAppleLogin() {
  try {
    const data = await AppleID.auth.signIn();

    const result = await uaa.loginWithApple(
      data.authorization.code,
      data.authorization.id_token
    );

    localStorage.setItem('access_token', result.access_token);
    console.log('Logged in user:', result.user);
  } catch (error) {
    console.error('Login failed:', error);
  }
}

Verify Token

const token = localStorage.getItem('access_token');
const verification = await uaa.verifyToken(token);

if (verification.valid) {
  console.log('Token is valid, user:', verification.user);
} else {
  console.log('Token is invalid or expired');
}

Get Current User

const token = localStorage.getItem('access_token');
const user = await uaa.getCurrentUser(token);
console.log('Current user:', user);

Refresh Token

const refreshToken = localStorage.getItem('refresh_token');
const result = await uaa.refreshToken(refreshToken);

// Update stored tokens
localStorage.setItem('access_token', result.access_token);
localStorage.setItem('refresh_token', result.refresh_token);

Logout

const token = localStorage.getItem('access_token');
await uaa.logout(token);

// Clear stored tokens
localStorage.removeItem('access_token');
localStorage.removeItem('refresh_token');

API Reference

UAAClient

Constructor

new UAAClient(config: UAAConfig)

Config Options:

  • projectId (required): Your project ID from UAA
  • baseURL (optional): UAA API base URL (default: https://auth.opensora.store/api/v1)

Methods

loginWithGoogle(credential: string): Promise<AuthResponse>

Login with Google OAuth credential.

loginWithApple(code: string, idToken: string): Promise<AuthResponse>

Login with Apple OAuth.

verifyToken(token: string): Promise<VerifyResponse>

Verify if an access token is valid.

getCurrentUser(token: string): Promise<User>

Get current user information.

refreshToken(refreshToken: string): Promise<AuthResponse>

Refresh an expired access token.

logout(token: string): Promise<void>

Logout and revoke tokens.

TypeScript Support

This SDK is written in TypeScript and includes full type definitions.

import { UAAClient, User, AuthResponse } from '@opensora/uaa-client';

License

MIT