Registry / auth-security / social-auth-express-v2

social-auth-express-v2

JSON →
library2.0.9jsnpmunverified

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).

npm install social-auth-express-v2
INSTALL
IMPORT
SIG · SOCIAL-AUTH-EXPRES
S
social-auth-express-v2
auth-securityjavascriptv2.0.9
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SocialAuth
const SocialAuth = require('social-auth-express');
import SocialAuth from 'social-auth-express';
This package uses CommonJS; ESM import not supported.
socialAuth
const socialAuth = new (require('social-auth-express'))({...});
Instantiate with new keyword and pass config object. The package exports a constructor.
onAuth callback
function(req, type, uniqueProperty, accessToken, refreshToken, profile, done) { done(null, user); }
function(req, type, profile, done) { ... }
The callback receives 7 parameters; omitting accessToken/refreshToken will cause undefined errors.

Sets up Express with a Facebook login using social-auth-express. Requires environment variables for API keys.

const express = require('express'); const app = express(); const SocialAuth = require('social-auth-express'); const socialAuth = new SocialAuth({ app: app, url: 'http://127.0.0.1:5000', onAuth: function(req, type, uniqueProperty, accessToken, refreshToken, profile, done) { // Find or create user, then call done done(null, profile); } }); socialAuth.use({ facebook: { settings: { clientID: process.env.FACEBOOK_ID || '', clientSecret: process.env.FACEBOOK_SECRET || '' }, url: { auth: '/auth/facebook', callback: '/auth/facebook/callback', success: '/', fail: '/auth/facebook/fail' } } }); app.listen(5000);
Debug
Known issues
deprecatedPackage uses older patterns; Passport strategies may require updates.
fix
Consider using Passport directly or a more modern library like Grant.
affects: >=2.0.0
gotchaThe onAuth callback must call done() or login hangs.
fix
Ensure done(null, user) is called in every code path.
affects: >=1.0.0
breakingVersion 2.0.0 changed the callback signature to include accessToken and refreshToken.
fix
Update callbacks to include all 7 parameters.
affects: >=2.0.0 <3.0.0
Errors
Common errors & fixes
Cannot find module 'social-auth-express'
Package not installed or typo in require path.
fix
Run 'npm install social-auth-express' and check the require statement is correct.
TypeError: socialAuth.use is not a function
SocialAuth not instantiated correctly (missing 'new').
fix
Use 'new (require('social-auth-express'))({...})'.
Error: OAuth2Strategy requires a clientID option
Missing or misspelled clientID in provider settings.
fix
Ensure settings object includes clientID and clientSecret exactly.
Upgrade
Version history
2.0.9latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
15 hits · last 30 days
node
12
OpenAI (training)
1
Resources
social-auth-express-v2 — npm install social-auth-express-v2 · libregistry