Auto-generated tile from GitHub (10 skills)
92
94%
Does it follow best practices?
Impact
92%
1.16xAverage score across 44 eval scenarios
Advisory
Suggest reviewing before use
A B2B SaaS startup is building an internal analytics dashboard using Fastify as the backend API framework. The dashboard needs user authentication via the company's existing identity provider (IdP), which supports OAuth 2.0. The engineering lead has decided that users should log in through the IdP using a browser-based flow, and that the backend should issue short-lived access tokens that can be refreshed without requiring the user to log in again.
The security team has raised concerns about previous implementations in other company projects that stored tokens insecurely and used outdated OAuth flows. They specifically want this implementation to follow current OAuth 2.0 security best practices for browser-based applications, and to use JWT validation that properly verifies the token's origin and intended audience, not just its signature.
The backend must expose at minimum:
/api/me that returns the authenticated user's subject identifierThe IdP's base URL is available as the environment variable AUTH_SERVER_URL. The client ID and secret are in CLIENT_ID and CLIENT_SECRET. The callback URL is http://localhost:3000/auth/callback. The expected token issuer is in EXPECTED_ISSUER and the expected audience is in EXPECTED_AUDIENCE.
Produce the following files:
src/plugins/oauth.ts — Fastify plugin registering the OAuth 2.0 providersrc/hooks/verifyToken.ts — request hook that validates JWT tokens on protected routessrc/routes/auth.ts — route handlers for login callback, logout, and token refreshsrc/routes/api.ts — protected API routes including /api/mepackage.json — listing all required dependenciesREADME.md — brief description of the authentication flow and how to run the serverevals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10
scenario-11
scenario-12
scenario-13
scenario-14
scenario-15
scenario-16
scenario-17
scenario-18
scenario-19
scenario-20
scenario-21
scenario-22
scenario-23
scenario-24
scenario-25
scenario-26
scenario-27
scenario-28
scenario-29
scenario-30
scenario-31
scenario-32
scenario-33
scenario-34
scenario-35
scenario-36
scenario-37
scenario-38
scenario-39
scenario-40
scenario-41
scenario-42
scenario-43
scenario-44
skills
documentation
fastify
init
linting-neostandard-eslint9
node
nodejs-core
rules
oauth
octocat
snipgrapher