{"id":41489225,"url":"https://github.com/eggjs/egg-passport-local","last_synced_at":"2026-01-23T18:16:20.784Z","repository":{"id":57220658,"uuid":"90712111","full_name":"eggjs/egg-passport-local","owner":"eggjs","description":"wrap passport-local strategy for egg-passport","archived":false,"fork":false,"pushed_at":"2019-07-31T08:06:59.000Z","size":13,"stargazers_count":44,"open_issues_count":1,"forks_count":4,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-10-07T18:44:11.822Z","etag":null,"topics":["egg-passport","egg-plugin","passport"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":false,"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/eggjs.png","metadata":{"files":{"readme":"README.md","changelog":"History.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-09T06:48:08.000Z","updated_at":"2025-04-10T18:39:50.000Z","dependencies_parsed_at":"2022-08-28T23:23:52.649Z","dependency_job_id":null,"html_url":"https://github.com/eggjs/egg-passport-local","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/eggjs/egg-passport-local","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fegg-passport-local","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fegg-passport-local/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fegg-passport-local/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fegg-passport-local/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eggjs","download_url":"https://codeload.github.com/eggjs/egg-passport-local/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fegg-passport-local/sbom","scorecard":{"id":368758,"data":{"date":"2025-08-11","repo":{"name":"github.com/eggjs/egg-passport-local","commit":"06912f71da119ef8a019b0c2a3cc04e44cb8d6e7"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.8,"checks":[{"name":"Code-Review","score":2,"reason":"Found 2/7 approved changesets -- score normalized to 2","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 4 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-18T12:29:37.805Z","repository_id":57220658,"created_at":"2025-08-18T12:29:37.805Z","updated_at":"2025-08-18T12:29:37.805Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28697428,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T17:25:48.045Z","status":"ssl_error","status_checked_at":"2026-01-23T17:25:47.153Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["egg-passport","egg-plugin","passport"],"created_at":"2026-01-23T18:16:20.158Z","updated_at":"2026-01-23T18:16:20.775Z","avatar_url":"https://github.com/eggjs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# egg-passport-local\n\n[![NPM version][npm-image]][npm-url]\n[![build status][travis-image]][travis-url]\n[![Test coverage][codecov-image]][codecov-url]\n[![David deps][david-image]][david-url]\n[![Known Vulnerabilities][snyk-image]][snyk-url]\n\n[npm-image]: https://img.shields.io/npm/v/egg-passport-local.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/egg-passport-local\n[travis-image]: https://img.shields.io/travis/eggjs/egg-passport-local.svg?style=flat-square\n[travis-url]: https://travis-ci.org/eggjs/egg-passport-local\n[codecov-image]: https://img.shields.io/codecov/c/github/eggjs/egg-passport-local.svg?style=flat-square\n[codecov-url]: https://codecov.io/github/eggjs/egg-passport-local?branch=master\n[david-image]: https://img.shields.io/david/eggjs/egg-passport-local.svg?style=flat-square\n[david-url]: https://david-dm.org/eggjs/egg-passport-local\n[snyk-image]: https://snyk.io/test/npm/egg-passport-local/badge.svg?style=flat-square\n[snyk-url]: https://snyk.io/test/npm/egg-passport-local\n\n## Install\n\n```bash\n$ npm i egg-passport --save\n$ npm i egg-passport-local --save\n```\n\n**Note:** also need [egg-passport](https://github.com/eggjs/egg-passport) .\n\n## Usage\n\n```js\n// {app_root}/config/plugin.js\nexports.passport = {\n  enable: true,\n  package: 'egg-passport',\n};\n\nexports.passportLocal = {\n  enable: true,\n  package: 'egg-passport-local',\n};\n```\n\n## Configuration\n\n```js\n// {app_root}/config/config.default.js\nexports.passportLocal = {\n  // usernameField: 'username',\n  // passwordField: 'password',\n};\n```\n\nThe available options are:\n\n- `usernameField` - Optional, defaults to `username`\n- `passwordField` - Optional, defaults to `password`\n\nBoth fields define the name of the properties in the POST body that are sent to the server.\n\nsee [config/config.default.js](config/config.default.js) for more detail.\n\nafter login successful, we can redirect to origin url by using `ctx.session.returnTo` before go to login page, for example:\n\n```js\nctx.session.returnTo = ctx.path;\n```\n\n## Example\n\nsee [fixture](test/fixtures/apps/passport-local-test) for more detail.\n\n```js\n// ./controller/home.js\nclass HomeController extends Controller {\n  async index() {\n    const ctx = this.ctx;\n    ctx.body = `\n      \u003cdiv\u003e\n        \u003ch2\u003e${ctx.path}\u003c/h2\u003e\n        \u003ca href=\"/admin\"\u003eadmin\u003c/a\u003e\n      \u003c/div\u003e\n    `;\n  }\n\n  async admin() {\n    const { ctx } = this;\n    if (ctx.isAuthenticated()) {\n      // show user info\n    } else {\n      // redirect to origin url by ctx.session.returnTo\n      ctx.session.returnTo = ctx.path;\n      await ctx.render('login.html');\n    }\n  }\n\n  async logout() {\n    const ctx = this.ctx;\n\n    ctx.logout();\n    ctx.redirect(ctx.get('referer') || '/');\n  }\n}\n```\n\n```js\n// router.js\nmodule.exports = app =\u003e {\n  app.router.get('/', 'home.render');\n  app.router.get('/admin', 'home.admin');\n\n  const localStrategy = app.passport.authenticate('local');\n  app.router.post('/passport/local', localStrategy);\n\n  app.router.get('/logout', 'user.logout');\n};\n```\n\nsee [passport example](https://github.com/eggjs/examples/tree/master/passport) for more detail.\n\n## Questions \u0026 Suggestions\n\nPlease open an issue [here](https://github.com/eggjs/egg/issues).\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feggjs%2Fegg-passport-local","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feggjs%2Fegg-passport-local","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feggjs%2Fegg-passport-local/lists"}