{"id":14989878,"url":"https://github.com/auth0/passport-linkedin-oauth2","last_synced_at":"2025-04-12T20:46:10.321Z","repository":{"id":7721667,"uuid":"9087562","full_name":"auth0/passport-linkedin-oauth2","owner":"auth0","description":"Passport Strategy for LinkedIn OAuth 2.0","archived":false,"fork":false,"pushed_at":"2024-07-19T07:43:05.000Z","size":75,"stargazers_count":121,"open_issues_count":46,"forks_count":109,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-03-21T17:56:26.714Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/auth0.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-03-28T22:17:51.000Z","updated_at":"2024-12-16T13:10:35.000Z","dependencies_parsed_at":"2024-12-06T14:01:54.348Z","dependency_job_id":"c12d02f9-8004-4f0a-89ef-316f6012f21e","html_url":"https://github.com/auth0/passport-linkedin-oauth2","commit_stats":{"total_commits":62,"total_committers":17,"mean_commits":"3.6470588235294117","dds":0.7580645161290323,"last_synced_commit":"87bd3076edb262933ebd460d367e8cd3aa941b23"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auth0%2Fpassport-linkedin-oauth2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auth0%2Fpassport-linkedin-oauth2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auth0%2Fpassport-linkedin-oauth2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auth0%2Fpassport-linkedin-oauth2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/auth0","download_url":"https://codeload.github.com/auth0/passport-linkedin-oauth2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248631702,"owners_count":21136559,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-24T14:19:03.911Z","updated_at":"2025-04-12T20:46:10.290Z","avatar_url":"https://github.com/auth0.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"A simple [Passport](http://passportjs.org/) strategy for LinkedIn OAuth2 that works with lite profile.\n\n## Install\n\nnpm install passport-linkedin-oauth2\n\n## Usage\n\nRegister the strategy\n\n```javascript\nvar LinkedInStrategy = require('passport-linkedin-oauth2').Strategy;\n\npassport.use(\n  new LinkedInStrategy(\n    {\n      clientID: LINKEDIN_KEY,\n      clientSecret: LINKEDIN_SECRET,\n      callbackURL: 'http://127.0.0.1:3000/auth/linkedin/callback',\n      scope: ['email', 'profile', 'openid'],\n    },\n    function (accessToken, refreshToken, profile, done) {\n      // asynchronous verification, for effect...\n      process.nextTick(function () {\n        // To keep the example simple, the user's LinkedIn profile is returned to\n        // represent the logged-in user. In a typical application, you would want\n        // to associate the LinkedIn account with a user record in your database,\n        // and return that user instead.\n        return done(null, profile);\n      });\n    }\n  )\n);\n```\n\nand then authenticate as:\n\n```javascript\napp.get(\n  '/auth/linkedin',\n  passport.authenticate('linkedin', { state: 'SOME STATE' }),\n  function (req, res) {\n    // The request will be redirected to LinkedIn for authentication, so this\n    // function will not be called.\n  }\n);\n```\n\nthe login callback:\n\n```javascript\napp.get(\n  '/auth/linkedin/callback',\n  passport.authenticate('linkedin', {\n    successRedirect: '/',\n    failureRedirect: '/login',\n  })\n);\n```\n\nSee [this](https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2) for details on LinkedIn API.\n\n## Auto-handle `state` param\n\nThe `state` param is used to prevent CSRF attacks, and is [required by the LinkedIn API](https://developer.linkedin.com/documents/authentication). You can ask Passport to handle the sending and validating of the `state` parameter by passing `state: true` as an option to the strategy:\n\n```javascript\nvar LinkedInStrategy = require('passport-linkedin-oauth2').Strategy;\n\npassport.use(\n  new LinkedInStrategy(\n    {\n      clientID: LINKEDIN_KEY,\n      clientSecret: LINKEDIN_SECRET,\n      callbackURL: 'http://127.0.0.1:3000/auth/linkedin/callback',\n      scope: ['email', 'profile', 'openid'],\n      state: true,\n    },\n    function (accessToken, refreshToken, profile, done) {\n      // asynchronous verification, for effect...\n      process.nextTick(function () {\n        // To keep the example simple, the user's LinkedIn profile is returned to\n        // represent the logged-in user. In a typical application, you would want\n        // to associate the LinkedIn account with a user record in your database,\n        // and return that user instead.\n        return done(null, profile);\n      });\n    }\n  )\n);\n```\n\nand then authenticate as:\n\n```javascript\napp.get(\n  '/auth/linkedin',\n  passport.authenticate('linkedin'),\n  function (req, res) {\n    // The request will be redirected to LinkedIn for authentication, so this\n    // function will not be called.\n  }\n);\n```\n\n## Issue Reporting\n\nIf you have found a bug or if you have a feature request, please report them at this repository issues section. Please do not report security vulnerabilities on the public GitHub issue tracker. The [Responsible Disclosure Program](https://auth0.com/whitehat) details the procedure for disclosing security issues.\n\n## Author\n\n[Auth0](auth0.com)\n\n## License\n\nThis project is licensed under the MIT license. See the [LICENSE](LICENSE) file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauth0%2Fpassport-linkedin-oauth2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fauth0%2Fpassport-linkedin-oauth2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauth0%2Fpassport-linkedin-oauth2/lists"}