Install any skill in seconds. Free to start, no credit card required.
Get Started Free →zzafergok/auth-patterns-nextjs
Authentication patterns for Next.js applications using NextAuth.js (Auth.js) v5. Covers OAuth providers, credentials auth, middleware protection, session management, and role-based access control.
Passed 24 of 24 test cases with the skill, and 22 of 24 without it.
2 fixed22 passed either way0 still failing0 broke
Tokens, turns and time describe resource use, not a dollar price.
This benchmark measured an earlier version of the skill.
One of 2 test cases the skill fixed. Same model, same prompt, with and without the skill.
On a custom login page at app/login/page.tsx, I need to redirect users to their intended destination after authentication. How should the login page capture the return destination?
| Checked | Without skill | With skill |
|---|---|---|
| extracts callbackUrl from search parameters | Missed | Passed |
The instructions your model reads when the skill loads.
Integrate Auth.js through the project's existing server boundaries without treating session presence as sufficient authorization.
Identify installed versions, adapter, session strategy, providers, route structure, runtime, deployment platform, database, existing user model, and authorization rules. Do not replace another authentication system unless migration is explicitly in scope.
Auth.js and Next.js APIs change. Use examples from current official documentation that match the installed versions rather than remembered configuration.
Use authentication to establish identity. Enforce authorization at every protected server entry point and data operation using roles, permissions, ownership, organization membership, or policy appropriate to the domain. Client-side guards improve UX but are not a security boundary.
Centralize authorization decisions where practical and deny by default. Avoid embedding mutable entitlements in long-lived session state without a refresh or revocation strategy.
Define where session lookup is safe and cacheable, how server components and route handlers access identity, how middleware is used, and which checks must still occur in the trusted handler or service. Avoid protecting only page navigation while leaving APIs exposed.
Model loading, unauthenticated, forbidden, expired, provider error, account collision, and partial onboarding states explicitly.
Test sign-in, sign-out, expiration, refresh, protected routes, server actions or handlers, ownership, roles, revoked access, provider denial, callback tampering, redirect validation, CSRF-sensitive actions, and concurrent sessions. Confirm cookie flags and production origins in the deployed environment.
Document the chosen session and authorization model, current version assumptions, and unverified provider behavior.
test cases passed, vs 22 / 24 without
More skills from the same source and nearby in the registry, with their headline benchmark lift.