Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | 1x 1x 2x 2x 2x 2x 2x 1x | "use strict"; const Auth = require('./Auth'); const Strategy = require('passport-linkedin-oauth2') .Strategy; /** * OAuth login using linkedin login provider * * Requires ```passport-linkedin-oauth2``` package. */ class LinkedinAuth extends Auth { /** * @param {object} options see Auth class + additional options for email configuration. */ constructor(options = {}) { super('linkedin', options); this.description.redirect = true; /** * OAuth 2 Client ID */ this.linkedinClientID = options.linkedinClientID; /** * OAuth 2 Client Secret */ this.linkedinClientSecret = options.linkedinClientSecret; /** * Should it construct urls based on proxy headers. */ this.proxy = options.proxy || false; } /** * @override */ install(app, prefix, passport) { passport.use(new Strategy({ clientID: this.linkedinClientID, clientSecret: this.linkedinClientSecret, callbackURL: `${prefix}/callback.json`, scope: ['r_emailaddress', 'r_basicprofile'], state: true, passReqToCallback: true, proxy: this.proxy, }, (req, accessToken, refreshToken, profile, done) => this.handleUserLoginByProfile(null, profile, done, req))); app.all(`${prefix}/login.json`, passport.authenticate('linkedin', {})); app.all(`${prefix}/callback.json`, passport.authenticate('linkedin', this.authenticateOptions), this.loggedIn(true)); } } module.exports = LinkedinAuth; |