Getting Started (React)
Add Google sign-in to a React app in 3 lines
Install
bun add @shoojs/reactAdd sign-in
import { useShooAuth } from "@shoojs/react";
export default function App() {
const { identity, loading, signIn, clearIdentity } = useShooAuth();
if (loading) return <p>Loading…</p>;
if (!identity.userId) return <button onClick={() => signIn()}>Sign in</button>;
return (
<div>
<p>Welcome, {identity.userId}</p>
<button onClick={clearIdentity}>Sign out</button>
</div>
);
}That's it. The hook handles PKCE, the Google redirect, token exchange, and persisting the user's identity.
Callback route (Next.js only)
Vite and other SPAs handle the callback automatically — no extra setup.
Next.js needs a page at the callback path so it doesn't 404:
"use client";
import { useShooAuth } from "@shoojs/react";
export default function ShooCallback() {
useShooAuth();
return <p>Signing in…</p>;
}Next steps
- Verify tokens on your server — required for production
- How the auth flow works
- Use with Convex
- Configuration options