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 small SaaS startup is building a Fastify-based API platform. Currently all endpoints are publicly accessible, but the product team has decided to add user authentication before the public launch. The engineering team has already registered the application with their identity provider (e.g. GitHub OAuth App or a corporate OIDC server) and received a client ID, client secret, and an authorization server URL.
The team wants a clean plugin-based approach that fits naturally into their existing Fastify application structure, so the implementation should be modular and follow Fastify conventions. Security is a priority: the team has been advised to implement the most current best practices for browser-based OAuth clients as defined in current RFCs and security guidelines.
Produce a working TypeScript (or JavaScript) implementation of the OAuth login flow for Fastify with the following files:
plugins/oauth.ts (or .js) — Fastify plugin that registers the OAuth providerroutes/auth.ts (or .js) — Route handlers for the login redirect and the callback that exchanges the authorization code for tokenspackage.json — listing the required dependenciesThe callback handler must securely handle the received tokens for later use in subsequent authenticated requests, following current security best practices for token storage.
Assume the following environment variables will be available at runtime:
CLIENT_IDCLIENT_SECRETAUTH_SERVER (base URL of the authorization server, e.g. https://github.com)CALLBACK_URI (the full redirect URI registered with the provider)evals
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