Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Documents how to use Better Auth for client-side sign-in, sign-out, and session checks plus server-side session validation.
41% 95%+55 ptsof test cases passed
Passed 21 of 22 test cases with the skill, and 9 of 22 without it.
We want to enable GitHub OAuth sign-in on our login page in a client component. I'm tempted to use `signIn('github')`. Write the client function call that handles social sign-in with GitHub and redirects to '/dashboard'.
Calls authClient.signIn.social
3 of 3 safety checks passed
We use Better Auth (better-auth) for identifying users.
lib/auth-client.ts exports authClient.lib/auth.ts exports auth.Use authClient for signing in, signing out, and checking session state in Client Components.
import { authClient } from "@/lib/auth-client";
// Sign In
await authClient.signIn.email({
email,
password,
});
// Social Sign In
await authClient.signIn.social({
provider: "google",
callbackURL: "/onboarding",
});
// Sign Out
await authClient.signOut();
Use auth.api.getSession for protecting API routes or Server Actions.
import { auth } from "@/lib/auth";
import { headers } from "next/headers";
const session = await auth.api.getSession({
headers: await headers()
Skills that do similar work, with their benchmark result.
Next to this one in the catalogue, plus more from the same author.