{"id":41978,"library":"social-auth-bxcore","title":"social-auth-express","description":"Social-auth-express is a PassportJS wrapper that simplifies adding social login (Facebook, Twitter, Google, GitHub, LinkedIn, Instagram, VK, Foursquare, Imgur, Meetup, Telegram) to Express apps. Version 1.0.4 stable, low release cadence. Differentiators: centralized onAuth callback, pre-parsed profile data, unique property detection, and minimal boilerplate vs raw PassportJS. Supports ESM via import but primarily CommonJS. No TypeScript types included; requires manual session setup.","status":"active","version":"1.0.4","language":"javascript","source_language":"en","source_url":null,"tags":["javascript"],"install":[{"cmd":"npm install social-auth-bxcore","lang":"bash","label":"npm"},{"cmd":"yarn add social-auth-bxcore","lang":"bash","label":"yarn"},{"cmd":"pnpm add social-auth-bxcore","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core authentication middleware used internally","package":"passport","optional":false},{"reason":"Required as peer dependency for Express integration","package":"express","optional":false}],"imports":[{"note":"Default export is a constructor. CommonJS require returns the constructor directly. Named import fails.","wrong":"const { SocialAuth } = require('social-auth-express')","symbol":"default","correct":"import SocialAuth from 'social-auth-express'"},{"note":"CommonJS require works; ESM import is also supported, but ensure no named import.","wrong":"import socialAuth from 'social-auth-express'","symbol":"SocialAuth (constructor)","correct":"const SocialAuth = require('social-auth-express')"},{"note":"The use() method expects a single object with provider keys, not separate arguments.","wrong":"socialAuth.use('facebook', { settings: {...}, url: {...} })","symbol":"socialAuth.use()","correct":"socialAuth.use({ facebook: { settings: {...}, url: {...} } })"}],"quickstart":{"code":"import express from 'express';\nimport SocialAuth from 'social-auth-express';\nimport session from 'express-session';\n\nconst app = express();\napp.use(session({ secret: 'your-secret', resave: true, saveUninitialized: true }));\n\nconst socialAuth = new SocialAuth({\n  app,\n  url: 'http://localhost:3000',\n  onAuth: (req, type, uniqueProperty, accessToken, refreshToken, profile, done) => {\n    // Find or create user based on profile and uniqueProperty\n    const user = { id: profile.id, name: profile.displayName };\n    done(null, user);\n  }\n});\n\nsocialAuth.use({\n  google: {\n    settings: {\n      clientID: process.env.GOOGLE_CLIENT_ID ?? '',\n      clientSecret: process.env.GOOGLE_CLIENT_SECRET ?? ''\n    },\n    url: {\n      auth: '/auth/google',\n      callback: '/auth/google/callback',\n      success: '/dashboard',\n      fail: '/login'\n    }\n  }\n});\n\napp.listen(3000, () => console.log('Server running on http://localhost:3000'));","lang":"typescript","description":"Sets up Express with sessions, initializes social-auth-express with Google OAuth, and configures routes."},"warnings":[{"fix":"Install and use express-session (or compatible session middleware) before initializing social-auth-express.","message":"Missing express-session middleware will cause silent failure or errors in Passport serialize/deserialize.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Provide full URL with protocol and port, like 'http://localhost:3000'.","message":"The 'url' option must include protocol (e.g., 'http://localhost:3000'), not just domain.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Update constructor call to object syntax: new SocialAuth({ app, url, onAuth }).","message":"In v1.0.0, the constructor parameter 'app' changed from Express instance to object with { app, url, onAuth }. Older code using 'new SocialAuth(app, url)' will break.","severity":"breaking","affected_versions":"<1.0.0"},{"fix":"Explicitly set 'strategy.profileURL' to 'https://graph.facebook.com/v2.6/me' and 'profileFields' as shown in docs.","message":"Facebook OAuth requires specifying strategy.profileURL and profileFields in v2.6+; default may not work.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Use the 'uniqueProperty' argument to dynamically determine which field from 'profile' to use for user identification.","message":"The 'onAuth' callback's 'uniqueProperty' can be 'id', 'ID', etc., depending on provider; your user lookup must handle this.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'1.0.4':33 'ad':15 'app':31 'auth':3,7 'boilerpl':52 'cadenc':37 'callback':41 'central':39 'commonj':62 'data':46 'detect':49 'differenti':38 'esm':57 'express':4,8,30 'facebook':18 'foursquar':25 'github':21 'googl':20 'imgur':26 'import':59 'includ':66 'instagram':23 'javascript':71 'linkedin':22 'login':17 'low':35 'manual':68 'meetup':27 'minim':51 'onauth':40 'pars':44 'passportj':11,55 'pre':43 'pre-pars':42 'primarili':61 'profil':45 'properti':48 'raw':54 'releas':36 'requir':67 'session':69 'setup':70 'simplifi':14 'social':2,6,16 'social-auth-express':1,5 'stabl':34 'support':56 'telegram':28 'twitter':19 'type':65 'typescript':64 'uniqu':47 'version':32 'via':58 'vk':24 'vs':53 'wrapper':12","created_at":"2026-06-04T18:55:01.753238+00:00","updated_at":"2026-06-04T18:55:01.753238+00:00","problems":[{"fix":"Verify that the callback URL in your provider app (e.g., 'http://localhost:3000/auth/google/callback') matches exactly the 'url.callback' property in socialAuth.use().","cause":"Invalid clientID/clientSecret or mismatched redirect URI in provider app settings.","error":"Error: OAuthCallback: failed to obtain access token"},{"fix":"Ensure you use 'new SocialAuth({...})' and assign result to a variable before calling .use().","cause":"Attempting to call socialAuth.use() without properly initializing socialAuth with 'new'.","error":"Cannot read property 'use' of undefined"},{"fix":"Use correct package name 'social-auth-express' and import default: 'import SocialAuth from 'social-auth-express'' or 'const SocialAuth = require('social-auth-express')'.","cause":"Using named import or wrong require path (e.g., 'social-auth-core' instead of 'social-auth-express').","error":"TypeError: socialAuthClass is not a constructor"},{"fix":"Add session middleware and passport serialization. Example: passport.serializeUser((user, done) => done(null, user));","cause":"Missing passport.serializeUser or express-session setup.","error":"Failed to serialize user into session"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":"social-auth-bxcore","openapi_spec":null,"status_page":null,"smithery":null,"categories":["security"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}