{"id":41489273,"url":"https://github.com/eggjs/egg-userservice","last_synced_at":"2026-01-23T18:16:34.822Z","repository":{"id":57220795,"uuid":"63518058","full_name":"eggjs/egg-userservice","owner":"eggjs","description":"userservice plugin for egg","archived":false,"fork":false,"pushed_at":"2019-10-24T03:14:22.000Z","size":15,"stargazers_count":21,"open_issues_count":0,"forks_count":4,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-09-10T20:51:11.572Z","etag":null,"topics":["egg","egg-plugin"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"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":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-07-17T06:27:53.000Z","updated_at":"2020-07-14T17:42:28.000Z","dependencies_parsed_at":"2022-08-28T23:23:23.302Z","dependency_job_id":null,"html_url":"https://github.com/eggjs/egg-userservice","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/eggjs/egg-userservice","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fegg-userservice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fegg-userservice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fegg-userservice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fegg-userservice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eggjs","download_url":"https://codeload.github.com/eggjs/egg-userservice/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fegg-userservice/sbom","scorecard":{"id":368784,"data":{"date":"2025-08-11","repo":{"name":"github.com/eggjs/egg-userservice","commit":"4bc3a880a7e61931ce276960df4e7450292716ab"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.8,"checks":[{"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":"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":"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":"Code-Review","score":5,"reason":"Found 7/14 approved changesets -- score normalized to 5","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":"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":"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":"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":"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":"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":"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":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"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 9 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:51.959Z","repository_id":57220795,"created_at":"2025-08-18T12:29:51.959Z","updated_at":"2025-08-18T12:29:51.959Z"},"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","egg-plugin"],"created_at":"2026-01-23T18:16:34.245Z","updated_at":"2026-01-23T18:16:34.815Z","avatar_url":"https://github.com/eggjs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# egg-userservice\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[![npm download][download-image]][download-url]\n\n[npm-image]: https://img.shields.io/npm/v/egg-userservice.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/egg-userservice\n[travis-image]: https://img.shields.io/travis/eggjs/egg-userservice.svg?style=flat-square\n[travis-url]: https://travis-ci.org/eggjs/egg-userservice\n[codecov-image]: https://codecov.io/github/eggjs/egg-userservice/coverage.svg?branch=master\n[codecov-url]: https://codecov.io/github/eggjs/egg-userservice?branch=master\n[david-image]: https://img.shields.io/david/eggjs/egg-userservice.svg?style=flat-square\n[david-url]: https://david-dm.org/eggjs/egg-userservice\n[snyk-image]: https://snyk.io/test/npm/egg-userservice/badge.svg?style=flat-square\n[snyk-url]: https://snyk.io/test/npm/egg-userservice\n[download-image]: https://img.shields.io/npm/dm/egg-userservice.svg?style=flat-square\n[download-url]: https://npmjs.org/package/egg-userservice\n\nUserservice plugin for Egg.\n\n**[DEPRECATED] use https://github.com/eggjs/egg-passport instead.**\n\nThis plugin provides a convention of how your application accesses current user data.\n\nYou can define the way to retrieve current user data according to the exact user\nstrategy your application is using.\n\nUser data may be stored in:\n\n- cookie\n- database\n- some kind of service\n- cache system(eg. redis)\n- etc..\n\nWhatever kind of strategy you are using, just configurate it with this plugin, and keep\nthe way of accessing user data unchanged, for a better understanding across the entire whole\negg community.\n\n\n---\n\n## Install\n\n```bash\n$ npm i egg-userservice\n```\n\n## Usage\n\n- `ctx.user`: current user data\n- `ctx.userId`: the user id of current user\n- `app.config.userservice.service.getUser(ctx)`:  \n- `app.config.userservice.service.getUserId(ctx)`:\n\n\n\n## Configuration\n\nAdd your userservice configurations to `config/config.default.js`\n\n```js\nexports.userservice = {\n  service: {\n    async getUser(ctx) {\n      // Retrieve your user data from cookie, redis, db, whatever\n      // For common web applications using cookie, you may get session id with ctx.cookies\n    },\n\n    getUserId(ctx) {\n      // The way to get userId\n      // eg. return ctx.user \u0026\u0026 ctx.user.userId\n    }\n  }\n}\n```\n\nIn your `config/plugin.js`\n\n```js\nexports.userservice = {\n  enable: true,\n  package: 'egg-userservice',\n};\n```\n\n\n\n\n\n## For complicated applications\n\nThe way your application retrieving user data can be complicated, it may be very weird\nif configurating it in a config file.\n\nA standalone plugin of your own can be a better solution. In this kind of situation,\n__the way of accessing data with `ctx.user` and `ctx.userId` should be left unchanged__.\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feggjs%2Fegg-userservice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feggjs%2Fegg-userservice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feggjs%2Fegg-userservice/lists"}