passport-linkedin-oauth2-proxied
v1.1.0
Published
LinkedIn OAuth2 strategy for Passport with configurable proxy URLs (e.g. Lambda).
Maintainers
Readme
passport-linkedin-oauth2-proxied
LinkedIn OAuth2 strategy for Passport.js with configurable URLs. Authorization, token exchange, and profile requests go either directly to LinkedIn (default) or through a proxy by setting full URLs only (no base URL + paths).
Installation
npm install passport-linkedin-oauth2-proxiedUsage
Default (direct LinkedIn)
Omit URL options to use standard LinkedIn endpoints.
const Strategy = require("passport-linkedin-oauth2-proxied").Strategy;
passport.use(
new Strategy(
{
clientID: process.env.LINKEDIN_CLIENT_ID,
clientSecret: process.env.LINKEDIN_CLIENT_SECRET,
callbackURL: process.env.LINKEDIN_CALLBACK_URL,
scope: ["openid", "profile", "email"],
},
(accessToken, refreshToken, profile, done) => {
return done(null, profile);
},
),
);Via proxy (full URLs)
Pass full URLs for each endpoint when using a proxy (Lambda, custom domain, etc.). If an option is omitted, the default LinkedIn URL is used.
passport.use(
new Strategy(
{
clientID: process.env.LINKEDIN_CLIENT_ID,
clientSecret: process.env.LINKEDIN_CLIENT_SECRET,
callbackURL: process.env.LINKEDIN_CALLBACK_URL,
scope: ["openid", "profile", "email"],
authorizationURL: process.env.LINKEDIN_AUTHORIZATION_URL, // optional
tokenURL: process.env.LINKEDIN_TOKEN_URL, // optional
profileURL: process.env.LINKEDIN_PROFILE_URL, // optional
},
(accessToken, refreshToken, profile, done) => {
return done(null, profile);
},
),
);Example env (use full URLs to your proxy, e.g. Lambda):
LINKEDIN_AUTHORIZATION_URL=https://your-proxy.example.com/oauth/authorizationLINKEDIN_TOKEN_URL=https://your-proxy.example.com/oauth/tokenLINKEDIN_PROFILE_URL=https://your-proxy.example.com/oauth/userinfo
License
CC BY-SA 4.0. Author: An1by (https://github.com/an1by).
