Authentication

Authentication built for AI apps

Wrap your app once and get passkeys, magic links, 2FA, sessions, and a real OAuth 2.0 provider — the same auth that guards every gateway request.

app/layout.tsx
import { HyperyProvider, SignedIn, SignedOut, SignIn, UserButton } from "@hyperyai/sdk"
 
export default function Layout({ children }) {
return (
<HyperyProvider config={{
clientId: process.env.NEXT_PUBLIC_HYPERY_CLIENT_ID,
redirectUri: "https://yourapp.com/callback",
gatewayUrl: "https://hypery.ai",
scopes: ["read", "ai:chat", "billing:read"],
}}>
<SignedIn><UserButton />{children}</SignedIn>
<SignedOut><SignIn /></SignedOut>
</HyperyProvider>
)
}
 

Login methods

Every way your users want to sign in

Five-plus first-class login methods, all wired to sessions and optional 2FA. No per-method glue code.

Passkeys / WebAuthn

Phishing-resistant passwordless login backed by the platform authenticator.

Magic link

One-tap email sign-in with no password to remember or leak.

Email and password

Classic credentials with forgot / reset flows handled end to end.

Google and GitHub

Social sign-in with the OAuth handshake managed for you.

TOTP 2FA and backup codes

Layer authenticator-app 2FA and recovery codes onto any method.

Sessions

Durable sessions with sign-out everywhere and per-device visibility.

React SDK

The @hyperyai/sdk React SDK

Components and hooks that render the whole auth surface — no bespoke state to manage.

  • HyperyProvider wraps your tree with { clientId, redirectUri, gatewayUrl, scopes }
  • SignedIn / SignedOut, Protect for scope-gated UI
  • SignIn, SignUp, UserButton, WorkspaceSwitcher drop-in components
  • useUser and useAuth hooks for fully custom flows
import { useUser, useAuth, Protect } from "@hyperyai/sdk"
 
function Account() {
const { user, isLoaded } = useUser()
const { signOut } = useAuth()
if (!isLoaded) return null
return (
<Protect scope="billing:read" fallback={<span>no access</span>}>
<p>{user.email}</p>
<button onClick={signOut}>sign out</button>
</Protect>
)
}
 

OAuth 2.0 provider

Let other apps build on you

Hypery is an OAuth 2.0 provider, not just a consumer. Issue clients, gate scopes, and let users authorize third-party apps against their account.

  • authorization_code + PKCE (S256) and refresh_token grants
  • /api/oauth/authorize, /api/oauth/token, /api/oauth/revoke
  • Consent screen with scope-escalation reprompt
  • Seven scopes: read, write, ai:chat, ai:completions, ai:models, ai:images, billing:read
const res = await fetch("https://hypery.ai/api/oauth/token", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
grant_type: "authorization_code",
code,
code_verifier: verifier,
client_id: process.env.HYPERY_CLIENT_ID,
redirect_uri: "https://yourapp.com/callback",
}),
})
const { access_token, refresh_token, expires_in } = await res.json()
 

FAQ

Questions

Is it a standards-compliant OAuth 2.0 provider?
Yes. Hypery exposes /api/oauth/authorize, /api/oauth/token, and /api/oauth/revoke with the authorization_code + PKCE (S256) and refresh_token grants, a consent screen, and scope-escalation reprompting.
Do you support passkeys?
Passkeys / WebAuthn are a first-class login method alongside magic links, email and password, Google, and GitHub. TOTP 2FA with backup codes is available on top of any of them.
Can I use my own UI instead of the drop-in components?
Yes. SignIn, SignUp, and UserButton are prebuilt, but useUser, useAuth, and the OAuth endpoints let you build a fully custom flow while Hypery still owns sessions, tokens, and 2FA.
What scopes can an app request?
The seven scopes are read, write, ai:chat, ai:completions, ai:models, ai:images, and billing:read. Each is shown on the consent screen and enforced on every gateway request.

Get started

Add auth in a few lines

Install the SDK, wrap your app, and hand your users passkeys, 2FA, and OAuth on day one.

$npm install @hyperyai/sdk