{"id":18807,"library":"social-auth-express-v2","title":"social-auth-express","description":"social-auth-express is a utility built on top of PassportJS that simplifies adding social logins to Express apps. Version 2.0.9 supports 10 social providers (Facebook, Twitter, VK, Instagram, LinkedIn, GitHub, Google, Foursquare, Imgur, Meetup) out of the box. It abstracts Passport's complexity by providing a centralized onAuth callback and pre-parsed profile data, reducing setup time to minutes. It uses Passport strategies internally and requires Express and passport. The package is stable but uses older patterns (require, callback-based).","status":"active","version":"2.0.9","language":"javascript","source_language":"en","source_url":null,"tags":["javascript"],"install":[{"cmd":"npm install social-auth-express-v2","lang":"bash","label":"npm"},{"cmd":"yarn add social-auth-express-v2","lang":"bash","label":"yarn"},{"cmd":"pnpm add social-auth-express-v2","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This package uses CommonJS; ESM import not supported.","wrong":"import SocialAuth from 'social-auth-express';","symbol":"SocialAuth","correct":"const SocialAuth = require('social-auth-express');"},{"note":"Instantiate with new keyword and pass config object. The package exports a constructor.","wrong":"","symbol":"socialAuth","correct":"const socialAuth = new (require('social-auth-express'))({...});"},{"note":"The callback receives 7 parameters; omitting accessToken/refreshToken will cause undefined errors.","wrong":"function(req, type, profile, done) { ... }","symbol":"onAuth callback","correct":"function(req, type, uniqueProperty, accessToken, refreshToken, profile, done) { done(null, user); }"}],"quickstart":{"code":"const express = require('express');\nconst app = express();\n\nconst SocialAuth = require('social-auth-express');\nconst socialAuth = new SocialAuth({\n  app: app,\n  url: 'http://127.0.0.1:5000',\n  onAuth: function(req, type, uniqueProperty, accessToken, refreshToken, profile, done) {\n    // Find or create user, then call done\n    done(null, profile);\n  }\n});\n\nsocialAuth.use({\n  facebook: {\n    settings: {\n      clientID: process.env.FACEBOOK_ID || '',\n      clientSecret: process.env.FACEBOOK_SECRET || ''\n    },\n    url: {\n      auth: '/auth/facebook',\n      callback: '/auth/facebook/callback',\n      success: '/',\n      fail: '/auth/facebook/fail'\n    }\n  }\n});\n\napp.listen(5000);","lang":"javascript","description":"Sets up Express with a Facebook login using social-auth-express. Requires environment variables for API keys."},"warnings":[{"fix":"Consider using Passport directly or a more modern library like Grant.","message":"Package uses older patterns; Passport strategies may require updates.","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Ensure done(null, user) is called in every code path.","message":"The onAuth callback must call done() or login hangs.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Update callbacks to include all 7 parameters.","message":"Version 2.0.0 changed the callback signature to include accessToken and refreshToken.","severity":"breaking","affected_versions":">=2.0.0 <3.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'npm install social-auth-express' and check the require statement is correct.","cause":"Package not installed or typo in require path.","error":"Cannot find module 'social-auth-express'"},{"fix":"Use 'new (require('social-auth-express'))({...})'.","cause":"SocialAuth not instantiated correctly (missing 'new').","error":"TypeError: socialAuth.use is not a function"},{"fix":"Ensure settings object includes clientID and clientSecret exactly.","cause":"Missing or misspelled clientID in provider settings.","error":"Error: OAuth2Strategy requires a clientID option"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}