netlify-identity

Implements authentication, OAuth login, and role-based access control on Netlify sites.

Updated May 19, 2026
One-click install
npx skills add https://github.com/costrict-plugins-repo/anthropic-netlify-skills --skill netlify-identity-costrict-plugins-repo
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: netlify-identity
Source: https://github.com/costrict-plugins-repo/anthropic-netlify-skills/tree/main/codex/skills/netlify-identity
Command: npx skills add https://github.com/costrict-plugins-repo/anthropic-netlify-skills --skill netlify-identity-costrict-plugins-repo

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @netlify/identity, @netlify/functions, and includes references (resource) components.

What problem does it solve? Adding user authentication to a Netlify site requires coordinating signup flows, OAuth providers, server-side session verification, and role-based gating, with many platform-specific pitfalls like dashboard-only configuration and CSRF requirements. ## Core Features & Use Cases - Client and server auth: Signup, login, logout, OAuth social login (Google/GitHub/GitLab/Bitbucket), and getUser() verification in Functions and Edge Functions via @netlify/identity. - Role-based access control: Assign roles at signup with Identity event functions, enforce Role conditions in redirect rules, and manage users with the Functions-only admin.* API. - Use Case: Gate an /admin section of your site so only users with the admin role can access it, with a login fallback page, server-side role checks in Functions, and roles assigned automatically at signup. ## Quick Start Add Netlify Identity authentication with GitHub OAuth login and role-based access control to my site.

Frequently Asked Questions about netlify-identity

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add login and signup to a Netlify site?

Enable Identity in the Netlify dashboard under Project configuration > Identity, install @netlify/identity, then call signup() and login() from your client code. Call handleAuthCallback() on your landing page to process confirmation, recovery, invite, and OAuth tokens.

How do I add Google or GitHub OAuth login with Netlify Identity?

Enable the provider under Registration > External providers in the dashboard, then call oauthLogin('github') or oauthLogin('google') from the client. Handle the redirect with handleAuthCallback(); never build a custom OAuth token exchange alongside Identity.

Does Netlify Identity work with netlify dev locally?

No, Identity does not work under netlify dev because the /.netlify/identity/* endpoints are unavailable locally. Test auth flows on a deployed site; Deploy Previews work for this purpose.

How do I restrict pages by user role on Netlify?

Add a Role condition to redirect rules in _redirects or netlify.toml, such as Role=admin, and always include a fallback rule so unauthorized users get a login page instead of a raw 404. Enforce sensitive checks server-side with getUser() and app_metadata.roles.

Why doesn't a role change take effect immediately in Netlify Identity?

Roles are baked into the nf_jwt token when issued and stay valid until expiry, about an hour. The user must log out and back in or refresh their session with refreshSession() to receive a token carrying the updated roles.

Can I use the Identity admin API in the browser or Edge Functions?

No, admin.* operations like listUsers() and updateUser() run only inside Netlify Functions, where the runtime provides a short-lived admin token automatically. They are not available in browser code or Edge Functions.