Introducing The Sweep: OX’s New Live Security Research Series
Register Now
Breaking: The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Read the Report
Are you exposed? Connect your apps in minutes.
Scan your apps free

@o/better-auth-utils

Latest version: v0.16.21-canary.1795564333132

Overview

Last scanned
24 Nov 2026
Published
24 Nov 2026
npm package Publisher: nwienert
63 Stars
4 Forks
162 Versions
15.4K Downloads
TypeScript Repo language

Scan summary

@o/better-auth-utils was last scanned on 24 Nov 2026 at version 0.16.21-canary.1795564333132. Risk score 0 of 100. No malicious behavior was detected.

  • Releases: 162 versions; the latest 5 were published on 24 Nov 2026.
  • Findings: No rules fired in version 0.16.21-canary.1795564333132.
  • Downloads: 15,414 downloads.

Versions

162 versions published
Versions and the rules that fired in each
VersionPublishedStatus
0.16.21-canary.1795564333132 LATEST 24 Nov 2026 No rules fired
0.16.21-canary.1795556921493 24 Nov 2026 No rules fired
0.16.21-canary.1795497004712 24 Nov 2026 Not shown
0.16.21-canary.1795496674195 24 Nov 2026 Not shown
0.16.21-canary.1795495690804 24 Nov 2026 Not shown

No rules fired in 0.16.21-canary.1795564333132

Findings

Findings for v0.16.21-canary.1795564333132. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.

The score describes 0.16.21-canary.1795564333132; other versions have their own rules, not their own score.

README

The publisher’s own README, as collected from the registry.

@o/better-auth-utils

Auth utilities for better-auth with React/React Native support.

Installation

bun add @o/better-auth-utils

Client Usage

import { createBetterAuthClient } from '@o/better-auth-utils'

const auth = createBetterAuthClient({
  baseURL: 'https://myapp.com',
  plugins: [
    /* better-auth plugins */
  ],
  // transform user object with app-specific fields
  createUser: (user) => ({ ...user, role: user.role as 'admin' | undefined }),
  // optional callbacks
  onAuthStateChange: (state) => console.log('Auth changed:', state),
  onAuthError: (error) => console.error('Auth error:', error),
})

// React hook for auth state
const { state, user, token } = auth.useAuth()

// get current auth state (non-reactive)
const { loggedIn } = auth.getAuth()

// clear all auth (localStorage + cookies)
auth.clearAllAuth()

// clear just localStorage token
auth.clearAuthClientToken()
Client Options
Option Type Default Description
baseURL string required Auth server URL
plugins array [] better-auth client plugins
createUser function identity Transform user object with app-specific typing
onAuthStateChange function - Callback when auth state changes
onAuthError function - Callback for auth errors
storagePrefix string 'auth' localStorage key prefix
retryDelay number 4000 Retry delay after errors (ms)
tokenValidationEndpoint string '/api/auth/validateToken' JWT validation endpoint
authCookieNames string[] ['better-auth.jwt', 'better-auth.session_token'] Cookie names to clear on clearAllAuth()
Client API
  • useAuth() - React hook returning { state, user, session, token }
  • getAuth() - Get current auth state (non-reactive), includes loggedIn boolean
  • setAuthClientToken({ token, session }) - Set auth token and session
  • clearAuthClientToken() - Clear localStorage token only
  • clearAllAuth() - Clear localStorage AND cookies
  • clearState() - Clear all auth state and storage
  • getValidToken() - Get valid JWT, refreshing if needed
  • authState - Emitter for subscribing to auth changes
  • authClientVersion - Emitter that updates when auth client recreates

Server Usage

import { validateToken, isValidJWT, InvalidTokenError } from '@o/better-auth-utils/server'

// validate JWT against JWKS endpoint
try {
  const payload = await validateToken(token, {
    baseUrl: 'https://myapp.com',
    forceIssuer: process.env.FORCE_ISSUER, // optional, for CI
    jwksPath: '/api/auth/jwks', // optional, default
  })
  console.log('User ID:', payload.sub)
} catch (err) {
  if (err instanceof InvalidTokenError) {
    // token invalid (malformed, expired, signature mismatch, etc)
    return Response.json({ error: 'INVALID_TOKEN' }, { status: 401 })
  }
}

// simple boolean check
const valid = await isValidJWT(token, { baseUrl: 'https://myapp.com' })
Server Exports
Export Description
validateToken(token, options) Validate JWT against JWKS, returns payload
isValidJWT(token, options) Boolean validation check
InvalidTokenError Error thrown for invalid tokens
JWKS Validation

The server validates JWTs against the JWKS endpoint (/api/auth/jwks by default). A fresh JWKS is fetched for each validation to avoid stale key cache issues.

License

MIT

OX Radar and Response Center

Find threats in your stack.

OX Radar can check high-priority threats, like critical package CVEs, against your context.

Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.

Where it’s listed

The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).

  • npm @o/better-auth-utils

References

The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.

Scan your whole stack

Group 1261154050 1
Group 1261154050
 

From OX Research Newsroom

Plug and Pray: Your AI Agents Are Taking Orders From Strangers
Research

Plug and Pray: Your AI Agents Are Taking Orders From Strangers

The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Vulnerability Insights

The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?

CVE

Java4Shell (CVE-2026-114938): Easy to Crash, Hard to Exploit — Less Than 0.12% of JVMs Estimated at Risk of RCE

Frame 2085668439 (1)
Group 1261154229