{"id":37532851,"url":"https://github.com/samueldonovan1701/express-cookie-session-auth","last_synced_at":"2026-01-16T08:34:03.126Z","repository":{"id":44637144,"uuid":"453479799","full_name":"samueldonovan1701/express-cookie-session-auth","owner":"samueldonovan1701","description":"NodeJS module for handling authentication and authorization using session tokens and cookies on an express web server","archived":false,"fork":false,"pushed_at":"2022-12-11T03:19:45.000Z","size":43,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-20T07:43:06.125Z","etag":null,"topics":["authentication","cookies","express","nodejs","sessions"],"latest_commit_sha":null,"homepage":"https://github.com/samueldonovan1701/express-auth/wiki","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/samueldonovan1701.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}},"created_at":"2022-01-29T18:11:56.000Z","updated_at":"2022-02-02T23:10:24.000Z","dependencies_parsed_at":"2023-01-26T14:45:22.142Z","dependency_job_id":null,"html_url":"https://github.com/samueldonovan1701/express-cookie-session-auth","commit_stats":null,"previous_names":["samueldonovan1701/express-auth"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/samueldonovan1701/express-cookie-session-auth","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samueldonovan1701%2Fexpress-cookie-session-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samueldonovan1701%2Fexpress-cookie-session-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samueldonovan1701%2Fexpress-cookie-session-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samueldonovan1701%2Fexpress-cookie-session-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/samueldonovan1701","download_url":"https://codeload.github.com/samueldonovan1701/express-cookie-session-auth/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samueldonovan1701%2Fexpress-cookie-session-auth/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28478047,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T06:30:42.265Z","status":"ssl_error","status_checked_at":"2026-01-16T06:30:16.248Z","response_time":107,"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":["authentication","cookies","express","nodejs","sessions"],"created_at":"2026-01-16T08:34:03.007Z","updated_at":"2026-01-16T08:34:03.104Z","avatar_url":"https://github.com/samueldonovan1701.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# express-cookie-session-auth\n\n`express-cookie-session-auth` is a simple, customizable authentication and authorization manager for express-based applications.\n\nWhile `express-cookie-session-auth` provides default in-memory user, group, and session managers, these can easily be overridden with developer-provided interfaces.\n\n\u003chr/\u003e\n\n\u003ctable\u003e\n\u003ctr\u003e\n    \u003ctd\u003e\u003cA href=\"https://github.com/samueldonovan1701/express-cookie-session-auth\"\u003eGitHub\u003c/a\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n    \u003ctd\u003e\u003cA href=\"https://github.com/samueldonovan1701/express-cookie-session-auth/wiki\"\u003eWiki\u003c/a\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n    \u003ctd\u003e\u003cA href=\"\"\u003enpm\u003c/a\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n    \u003ctd\u003e\u003cA href=\"https://github.com/samueldonovan1701/express-cookie-session-auth/issues\"\u003eReport an Issue\u003c/a\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n    \u003ctd\u003eAuthor: \u003ca href=\"https://github.com/samueldonovan1701\"\u003eSamuel Donovan\u003c/a\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n    \u003ctd\u003eLicense: \u003ca href=\"http://creativecommons.org/licenses/by-sa/3.0/us/\"\u003eCreative Commons Attribution-ShareAlike 3.0 United States License\u003c/a\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n# Install\nTODO: put on npm\n\u003cpre\u003e\u003ccode\u003e\nnpm install express-cookie-session-auth\n\u003c/code\u003e\u003c/pre\u003e\n\n# Setup\n\u003cpre\u003e\u003ccode\u003e\nconst express = require('express');\nconst app = express();\n\napp.use(express.json()); //Not always needed\n\nconst cookieParser = require('cookie-parser');\napp.use(cookieParser(\"secret\"));\n\nconst auth = require('express-cookie-session-auth');\napp.use(auth);\n\u003c/code\u003e\u003c/pre\u003e\n\n# Examples\n### Get User\n\u003cpre\u003e\u003ccode\u003e\napp.get('/', (req, res) =\u003e {\n    if(req.user)\n        res.send(`Logged in as ${req.user.id}`);\n    else\n        res.send(`Not logged in`);\n});\n\u003c/code\u003e\u003c/pre\u003e\n\n### Users \u0026 Groups\n\u003cpre\u003e\u003ccode\u003e\nauth.users.add(\"John Doe\", \"password1234\", {\n    address: \"1234 Main St.\",\n    phone: \"(000)000-000\"\n});\n\nauth.groups.new(\"example group\", [\"John Doe\"]);\n\nconsole.log(auth.users.get(\"John Doe\");\nconsole.log(auth.groups.with(\"John Doe\");\n\u003c/code\u003e\u003c/pre\u003e\n\n### Logging in/out\n\u003cpre\u003e\u003ccode\u003e\napp.post('/login', (req, res) =\u003e {\n    let username = req.body.username;\n    let password = req.body.username;\n    let loggedIn = auth.login(req, res, username, password);\n    ...\n});\n\napp.post('/logout', (req, res) =\u003e {\n    let loggedOut = auth.logout(req, res);\n    ...\n});\n\u003c/code\u003e\u003c/pre\u003e\n\n### Restricting Access\n\u003cpre\u003e\u003ccode\u003e\napp.use(\"/admin\", auth.onlyUsers(\"admin\"));\n\napp.use(\"/manage-users\", auth.onlyGroups(\"managers\"));\n\u003c/code\u003e\u003c/pre\u003e\n# Dependencies\n\n### \u003ca href=\"https://expressjs.com/\"\u003eExpress\u003c/a\u003e\n`express-cookie-session-auth` is built specifically to be used with Express web framework for Node.js\n\nExpress is distributed under the \u003ca href=\"https://creativecommons.org/licenses/by-sa/3.0/us/\"\u003eCreative commons license\u003c/a\u003e.\n\n### \u003ca href=\"https://www.npmjs.com/package/cookie-parser\"\u003ecookie-parser\u003c/a\u003e\n`express-cookie-session-auth` uses cookies to track sessions, and `cookie-parser` makes this easier, as well as allow for the use of signed cookies.\n\n`cookie-parser` is distributed under the \u003ca href=\"https://github.com/expressjs/cookie-parser/blob/HEAD/LICENSE\"\u003eMIT license\u003c/a\u003e.\n\n### \u003ca href=\"https://expressjs.com/en/api.html#express.json\"\u003eexpress.json()\u003c/a\u003e (optional)\nUsed by the `auth.login.endpoint` for the username and password. Does not need to be used if `auth.login.endpoint` is never used.\n\nThis module is included with Express.\n\n# License\nThis work is licensed under a \u003ca href=\"http://creativecommons.org/licenses/by-sa/3.0/us/\"\u003eCreative Commons Attribution-ShareAlike 3.0 United States License\u003c/a\u003e.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamueldonovan1701%2Fexpress-cookie-session-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamueldonovan1701%2Fexpress-cookie-session-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamueldonovan1701%2Fexpress-cookie-session-auth/lists"}