authentication
authentication built for ai apps
wrap your app once and get passkeys, magic links, 2fa, sessions, and a real oauth2 provider — the same auth that guards every gateway request.
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 + password
classic credentials with forgot / reset flows handled end to end.
google & github
social sign-in with the oauth handshake managed for you.
totp 2fa + 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> )} oauth2 provider
let other apps build on you
hypery is an oauth2 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 oauth2 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 + 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.