{"id":18598,"library":"netlify-auth-providers","title":"Netlify Auth Providers","description":"Netlify Auth Providers is an alpha-stage library (v1.0.0-alpha5) for authenticating with Netlify's external OAuth providers. It provides a simple client that handles the authentication flow, token storage, and refresh. As an alpha release, the API is unstable and may change without notice. Key differentiators include direct integration with Netlify's Identity service and minimal configuration required.","status":"deprecated","version":"1.0.0-alpha5","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","netlify"],"install":[{"cmd":"npm install netlify-auth-providers","lang":"bash","label":"npm"},{"cmd":"yarn add netlify-auth-providers","lang":"bash","label":"yarn"},{"cmd":"pnpm add netlify-auth-providers","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"uses Netlify client and typings","package":"netlify","optional":false}],"imports":[{"note":"ESM-only package; CommonJS require is not supported.","wrong":"const NetlifyAuthProviders = require('netlify-auth-providers')","symbol":"default","correct":"import NetlifyAuthProviders from 'netlify-auth-providers'"},{"note":"Exported class for managing OAuth flows.","symbol":"Authenticator","correct":"import { Authenticator } from 'netlify-auth-providers'"},{"note":"Interface for custom token storage; not exported in earlier alphas.","symbol":"TokenStore","correct":"import { TokenStore } from 'netlify-auth-providers'"}],"quickstart":{"code":"import NetlifyAuthProviders from 'netlify-auth-providers';\n\nconst client = new NetlifyAuthProviders({\n  provider: 'github',\n  clientId: process.env.GITHUB_CLIENT_ID ?? '',\n  redirectUri: 'http://localhost:8888/callback'\n});\n\n// Start OAuth flow\nclient.authenticate();\n\n// After redirect, handle callback\nclient.handleCallback();\n\n// Get access token\nconst token = client.getToken();\nconsole.log({ token });","lang":"typescript","description":"Demonstrates initializing the client, starting OAuth, handling callback, and retrieving token."},"warnings":[{"fix":"Pin to exact version and test each upgrade.","message":"Alpha release: no stable API; breaking changes occur without warning.","severity":"breaking","affected_versions":"<=1.0.0-alpha5"},{"fix":"Migrate to netlify-identity-widget for UI integration or use Netlify Identity JS client.","message":"Package is deprecated in favor of netlify-identity-widget or direct Identity API.","severity":"deprecated","affected_versions":"all"},{"fix":"Ensure redirectUri matches the exact page where handleCallback is called.","message":"OAuth redirect must be handled on the same origin; CORS errors occur if mismatched.","severity":"gotcha","affected_versions":"all"},{"fix":"Implement custom TokenStore that uses cookies or other storage.","message":"Token storage defaults to localStorage; may not be available in SSR environments.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Use ES module import syntax (import ... from).","cause":"Using CommonJS require on an ESM-only package.","error":"TypeError: netlify_auth_providers_1.default is not a constructor"},{"fix":"Specify provider in options object (case-sensitive).","cause":"Provider list not initialized or incorrect provider name.","error":"Error: Could not find provider 'github'. Available providers: []"},{"fix":"Ensure the redirectUri matches exactly what is configured in Netlify dashboard.","cause":"Redirect URI does not match Netlify app settings.","error":"OAuth callback failed: invalid redirect_uri"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}