{"id":27248563,"url":"https://github.com/daack/basic-sso","last_synced_at":"2026-06-23T12:02:40.591Z","repository":{"id":57189264,"uuid":"83286769","full_name":"daack/basic-sso","owner":"daack","description":"Basic authentication mechanism for Single sign-on","archived":false,"fork":false,"pushed_at":"2017-04-27T15:47:35.000Z","size":22,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-29T21:02:09.802Z","etag":null,"topics":["authentication","sso"],"latest_commit_sha":null,"homepage":null,"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/daack.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":"2017-02-27T08:30:18.000Z","updated_at":"2017-06-14T10:53:24.000Z","dependencies_parsed_at":"2022-09-15T04:01:39.054Z","dependency_job_id":null,"html_url":"https://github.com/daack/basic-sso","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daack%2Fbasic-sso","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daack%2Fbasic-sso/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daack%2Fbasic-sso/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daack%2Fbasic-sso/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/daack","download_url":"https://codeload.github.com/daack/basic-sso/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248055272,"owners_count":21040153,"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":["authentication","sso"],"created_at":"2025-04-10T23:40:09.524Z","updated_at":"2026-06-23T12:02:40.550Z","avatar_url":"https://github.com/daack.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Basic SSO :unlock:\n\nBasic authentication mechanism for Single sign-on\n\n* [Install](#install)\n* [Example](#example)\n\n\u003ca name=\"install\"\u003e\u003c/a\u003e\n\n## Install\n\nTo install basic-sso, simply use npm:\n\n```\nnpm install basic-sso --save\n```\n\n\u003ca name=\"example\"\u003e\u003c/a\u003e\n\n## Example\n\n### Server\n\n```javascript\nconst app = require('express')()\nconst Sso = require('basic-sso')\n\nconst sso = Sso('server_unique_app_name', {\n\tprime: 'diffie_hellman_prime',\n\tlisten: 8001 // port for key exchange\n})\n\nconst server = sso.server({\n\tdomain: 'foo.com',\n\tcookie: {\n\t\tsecret: 'password',\n\t\tkeylist: ['foo', 'bar'],\n\t\tname: 'sso_signed',\n\t\tsecure: false,\n\t\thttpOnly: true\n\t}\n})\n\nserver.addApp('client', {\n\tredirect: 'http://127.0.0.1:3000/landing'\n})\n\nserver.strategy('strategy', (username, password, done) =\u003e {\n  const user = User.findByUsername(username)\n\n  // Compare password\n\n  done(null, user)\n})\n\nserver.authorizeUser((user, app, done) =\u003e {\n  // if user can access this app\n\n  done(null, {\n    // user info to return to client\n  })\n})\n\nserver.serializeUser((user, done) =\u003e {\n  // What to put in the cookie\n  done(null, user.id)\n})\n\nserver.deserializeUser((id, done) =\u003e {\n  // Retrive user from cookie\n  const user = User.findById(id)\n  done(null, user)\n})\n\n// Endpoint to authenticate user\napp.get('/auth', server.authenticate(), (req, res, next) =\u003e {\n\t// render login page\n})\n// Endpoint to login user\napp.post('/login', server.logIn('strategy'))\n```\n\n### Client\n\n```javascript\nconst app = require('express')()\nconst Sso = require('basic-sso')\n\nconst sso = Sso('client_unique_app_name', {\n\tprime: 'diffie_hellman_prime',\n\tlisten: 8002 // port for key exchange\n})\n\nconst client = sso.client({\n\tverify: 'verify',\n\tserver: {\n\t\tname: 'server',\n\t\thost: '127.0.0.1',\n\t\tport: 3000,\n\t\tdh_port: 8001,\n\t\tauth_path: '/auth'\n\t}\n})\n\napp.get('/login', (req, res) =\u003e {\n\tclient.redirectLogIn(res)\n})\n\napp.get('/landing', client.landing(), (req, res) =\u003e {\n\tconsole.log(req.user)\n})\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaack%2Fbasic-sso","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaack%2Fbasic-sso","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaack%2Fbasic-sso/lists"}