netlify-identity
Add user authentication to a Netlify site with @netlify/identity — signup/login/logout, Google/GitHub/GitLab/Bitbucket OAuth, server-side getUser() checks…
Skill by netlifyOfficial
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/netlify-netlify-identity-fb84e1
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: backend, cloud, security, writing
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions: not checked yet.
What's inside
- Skill name
netlify-identity- Description
- Add user authentication to a Netlify site with @netlify/identity — signup/login/logout, Google/GitHub/GitLab/Bitbucket OAuth, server-side getUser() checks, role-based access control, and Identity event functions. Use it when a task involves adding a login or signup form, gating content to members or roles, "auth middleware" or verifying users in Netlify Functions or Edge Functions, handling OAuth or email-confirmation callbacks, assigning roles at signup, or customizing Identity emails. For locking a whole site to your company or employees-only access, use netlify-access-control instead.
- License
- MIT
- Instructions
- 264 lines in SKILL.md · view on GitHub
Before installing
- Instructions call the network
Files (3)
- SKILL.md
- advanced-patterns.md · references/
- authorization-and-sessions.md · references/
SKILL.md (first lines)
# Netlify Identity
Use `@netlify/identity` (npm). For new projects it replaces the legacy `netlify-identity-widget` and `gotrue-js` — do not reach for those.
```bash
npm install @netlify/identity
```
Framework examples (Next.js/Astro/Remix/SvelteKit) and the full API reference are in the [`@netlify/identity` README on npm](https://www.npmjs.com/package/@netlify/identity).
> **Identity does not run under `netlify dev`.** Test all auth flows on a deploy — Deploy Previews work. Local dev will not complete signup/login/OAuth.
> **Identity config is dashboard-only — there is no public API.** Never curl `api.netlify.com` to flip or read Identity settings, never read tokens from local Netlify config, never probe undocumented endpoints. Enable and configure Identity at `https://app.netlify.com/projects/{site_name}/identity`.
> **Never build a from-scratch OAuth flow alongside Identity.** No provider app registration in code, no `client_id`/`secret` in source, no custom callback token exchange. Use `oauthLogin()` + `handleAuthCallback()`. Raw OAuth beside Identity is the most common source of rework.
## Client auth (browser)
```ts
import { signup, login, logout, getUser, oauthLogin, handleAuthCallback } from '@netlify/identity'
// Register — confirmation email sent by default (unless autoconfirm is on)
const user = await signup('jane@example.com', 'securepassword', { full_name: 'Jane Doe' })
// Log in / out
await login('jane@example.com', 'securepassword')
await logout()
// Current user or null
const current = await getUser()
if (current) console.log(`Logged in as ${current.email}`)
// External provider — redirects the browser; provider is one of
// 'google' | 'github' | 'gitlab' | 'bitbucket'
oauthLogin('github')
```
> **`handleAuthCallback()` is mandatory on your landing page.** Without it, OAuth redirects, email-confirmation links, password-recovery links, and invite links never complete. Call it on page load:
```ts
import { handleAuthCallback } from '@netlify/identity'
const result = await handleAuthCallback() // falsy if no token in URL hash
if (result) console.log(result.type, result.user.email) // confirmation | invite | recovery | email change
```
Alternatives for a single token type: `recoverPassword()` (recovery), `acceptInvite()` (invite). Refresh a session with `refreshSession()`.
Don't hard-code which providers exist. Call `getSettings()` at startup and render the signup form and OAuth buttons from what it returns.
## Server-side auth (Netlify Functions & Edge Functions)
Server-side `getUser()`/`login()`/`admin.*` require modern **v2 functions** (`export default`). The v1 `export { handler }` form is not supported.
`getUser()` works in both runtimes. **`admin.*` runs ONLY in Netlify Functions — not the browser, not Edge Functions.**
```ts
// netlify/functions/me.ts — verify user
import { getUser } from '@netlify/identity'
import type { Context } from '@netlify/functions'
export default async (req: Request, context: Context) => {
const user = await getUser()
if (!user) return new Response('Unauthorized', { status: 401 })
return Response.json({ id: user.id, email: user.email })
}
```
Edge Function form is identical but imports `Context` from `@netlify/edge-functions`.
### Role checks
```ts
// netlify/functions/admin-users.ts
import { getUser, admin } from '@netlify/identity'
import type { Context } from '@netlify/functions'
export default async (req: Request, context: Context) => {
const user = await getUser()
if (!user) return new Response('Unauthorized', { status: 401 })
if (!user.roles.includes('admin')) return new Response('Forbidden', { status: 403 })
const users = await admin.listUsers()
return Response.json({ users })
}
```
### CSRF: required for server-side auth endpoints
> Any endpoint that runs `login()`, `signup()`, or `logout()` server-side **must** call `verifyRequestOrigin(req)` at the top of the handler. It throws a 403 on origin mismatch.
```ts
// netlify/functions/login.ts
import { login, verifyRequestOrigin } from '@netlify/identity'
import type { Context } from '@netlify/functions'
export default async (req: Request, context: Context) => {
verifyRequestOrigin(req)
const { email, password } = await req.json()
await login(email, password)
return new Response(null, { status: 302, headers: { Location: '/dashboard' } })
}
```
## Identity event functions
The platform calls your handler when an Identity event occurs. Export a default object with a method per event. File: `netlify/functions/identity.mts`.
> Typed handlers (`UserSignupEvent`, `event.deny()`) require `@netlify/functions` ≥ 5.2.0. Older installs must use the legacy filename convention (`identity-signup.ts`, etc.) — see `references/authorization-and-sessions.md`.
| Handler | Fires when |
|---|---|
| `userValidate` | Signup attempt, before account creation. Block bad signups here. |
| `userSignup` | Signup completes (after email confirmation if enabled). Assign roles, sync, welcome. |
| `userLogin` | User logs in. Track/last-seen/block. |
| `userModified` | Profile updated. |
| `userDeleted` | User deleted (notification only). |
Event `user` fields are camelCase (`appMetadata`, `userMetadata`, `confirmedAt`).From netlify/context-and-tools, MIT.
More from netlify/context-and-tools
- 0.761score
netlify-frameworks
netlifyOfficial
Deploy and configure web frameworks on Netlify — build settings and SSR/edge adapters plus local platform emulation and env vars.
SkillAFreshness: A★ 43Claude Code +9 - 0.761score
netlify-identity
netlifyOfficial
Add user authentication to a Netlify site with @netlify/identity — signup/login/logout, Google/GitHub/GitLab/Bitbucket OAuth, server-side getUser() checks…
SkillAFreshness: A★ 43Claude Code +9 - 0.761score
netlify-access-control
netlifyOfficial
Picks the right Netlify site-protection layer and disambiguates the three unrelated "auth" concepts users conflate — app-user login (Netlify Identity)…
SkillAFreshness: A★ 43Claude Code +9 - 0.761score
netlify-mcp-servers
netlifyOfficial
Build, deploy, and secure Model Context Protocol (MCP) servers on Netlify.
SkillAFreshness: A★ 43Claude Code +9 - 0.761score
netlify-deploy
netlifyOfficial
Create, configure, and manage Netlify deploys from code — reach for this when setting up Git continuous deployment, running netlify deploy or netlify deploy…
SkillAFreshness: A★ 43Claude Code +9 - 0.761score
netlify-database
netlifyOfficial
Zero-config Postgres for Netlify apps via @netlify/database — querying data from Functions/Edge Functions, writing schema migrations, setting up Drizzle ORM…
SkillAFreshness: A★ 43Claude Code +9 - 0.755score
netlify-agent-runner
netlifyOfficial
Run AI agent tasks remotely on Netlify using Claude, Codex, or Gemini.
SkillAFreshness: A★ 43Claude Code +9 - 0.755score
netlify-edge-functions
netlifyOfficial
Write, route, cache, and debug Netlify Edge Functions, the Deno-based TypeScript or JavaScript handlers in netlify/edge-functions that run at the network edge…
SkillAFreshness: A★ 43Claude Code +9 - 0.755score
netlify-functions
netlifyOfficial
Write, configure, and deploy Netlify serverless functions in TypeScript, JavaScript, or Go.
SkillAFreshness: A★ 43Claude Code +9 - 0.755score
netlify-ai-gateway
netlifyOfficial
Use Netlify AI Gateway to call OpenAI, Anthropic Claude, Google Gemini, TypeSafe (Jev), or OpenRouter-hosted models (xAI/DeepSeek/Meta/Mistral/Qwen) from…
SkillAFreshness: A★ 43Claude Code +9 - 0.755score
netlify-blobs
netlifyOfficial
Store and retrieve unstructured objects, files, and cache-like state on Netlify with the @netlify/blobs module.
SkillAFreshness: A★ 43Claude Code +9 - 0.755score
netlify-caching
netlifyOfficial
Cache dynamic and static responses on Netlify's CDN from Functions, Edge Functions, and proxies.
SkillAFreshness: A★ 43Claude Code +9
Signals
- Stars
- 43
- Forks
- 13
- Open issues
- 3
- Last commit (this folder)
- Sep 21, 2026 (1 month ago)
- Last release
- Oct 8, 2026 (20 days ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/netlify/context-and-tools
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
Same skill elsewhere
Copies of this SKILL.md published by others; search shows only one of them.
- 0.761score
netlify-identity
netlifyOfficial
Add user authentication to a Netlify site with @netlify/identity — signup/login/logout, Google/GitHub/GitLab/Bitbucket OAuth, server-side getUser() checks…
SkillAFreshness: A★ 43Claude Code +9 - 0.397score
netlify-identity
netlifyOfficial
Add user authentication to a Netlify site with @netlify/identity — signup/login/logout, Google/GitHub/GitLab/Bitbucket OAuth, server-side getUser() checks…
SkillAFreshness: A★ 43Claude Code +9
More from netlify
- 0.761score
netlify-frameworks
netlifyOfficial
Deploy and configure web frameworks on Netlify — build settings and SSR/edge adapters plus local platform emulation and env vars.
SkillAFreshness: A★ 43Claude Code +9 - 0.761score
netlify-identity
netlifyOfficial
Add user authentication to a Netlify site with @netlify/identity — signup/login/logout, Google/GitHub/GitLab/Bitbucket OAuth, server-side getUser() checks…
SkillAFreshness: A★ 43Claude Code +9 - 0.761score
netlify-access-control
netlifyOfficial
Picks the right Netlify site-protection layer and disambiguates the three unrelated "auth" concepts users conflate — app-user login (Netlify Identity)…
SkillAFreshness: A★ 43Claude Code +9 - 0.761score
netlify-deploy
netlifyOfficial
Create, configure, and manage Netlify deploys from code — reach for this when setting up Git continuous deployment, running netlify deploy or netlify deploy…
SkillAFreshness: A★ 43Claude Code +9 - 0.761score
netlify-database
netlifyOfficial
Zero-config Postgres for Netlify apps via @netlify/database — querying data from Functions/Edge Functions, writing schema migrations, setting up Drizzle ORM…
SkillAFreshness: A★ 43Claude Code +9 - 0.761score
netlify-mcp-servers
netlifyOfficial
Build, deploy, and secure Model Context Protocol (MCP) servers on Netlify.
SkillAFreshness: A★ 43Claude Code +9
Cite this page
netlify-identity skill. Agent Mart. https://agentmart.dev/skills/netlify-netlify-identity-fb84e1 (last updated 2026-10-24)