{"id":17712686,"url":"https://github.com/gribouille/json-auth-server","last_synced_at":"2026-04-18T06:32:28.528Z","repository":{"id":135350075,"uuid":"116008781","full_name":"gribouille/json-auth-server","owner":"gribouille","description":"JSON Web token server with GraphQL API","archived":false,"fork":false,"pushed_at":"2018-02-18T20:05:54.000Z","size":1313,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-03-10T14:53:02.169Z","etag":null,"topics":["express-js","functional-programming","graphql","javascript","jsonwebtoken","jwt-authentication","node-js","server"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gribouille.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":"2018-01-02T11:35:04.000Z","updated_at":"2018-02-14T10:31:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"d8d94fe4-6094-444b-b488-e0827564bc52","html_url":"https://github.com/gribouille/json-auth-server","commit_stats":null,"previous_names":[],"tags_count":1,"template":null,"template_full_name":null,"purl":"pkg:github/gribouille/json-auth-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gribouille%2Fjson-auth-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gribouille%2Fjson-auth-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gribouille%2Fjson-auth-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gribouille%2Fjson-auth-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gribouille","download_url":"https://codeload.github.com/gribouille/json-auth-server/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gribouille%2Fjson-auth-server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31959877,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T00:39:45.007Z","status":"online","status_checked_at":"2026-04-18T02:00:07.018Z","response_time":103,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["express-js","functional-programming","graphql","javascript","jsonwebtoken","jwt-authentication","node-js","server"],"created_at":"2024-10-25T09:42:32.964Z","updated_at":"2026-04-18T06:32:28.489Z","avatar_url":"https://github.com/gribouille.png","language":"JavaScript","readme":"# json-auth-server\n:mushroom: JSON Web token server with GraphQL API (JAS).\n\n## Usage\n\n### Production \n\n_Requirements: docker and docker-compose._\n\nReady to use:\n```\n\u003e docker-compose up\n```\n\nThe JAS server is started by default on `http://172.25.0.4:8080`.\n\nTo generate a new token with the admin account:\n```\n\u003e curl -X POST -H \"Content-Type: application/json\" \\\n  -d '{\"login\": \"admin\", \"password\": \"admin\"}' http://172.25.0.4:8080/auth\n\n{\n    \"success\": true,\n    \"message\": \"admin found!\",\n    \"data\": \"...\"\n}\n```\n\nFor example, to list the users:\n```\n\u003e curl -X POST -H \"Content-Type: application/json\" \\\n  -H \"authorization: Bearer ...\" \\\n  -d '{ \"query\": \"query { users { id username is_active date_joined } }\" }' http://172.25.0.4:8080/graphql\n\n{\n    \"data\": {\n        \"users\": [\n            {\n                \"id\": 1,\n                \"username\": \"admin\",\n                \"is_active\": true,\n                \"date_joined\": \"Tue Feb 13 2018 20:27:11 GMT+0000 (UTC)\"\n            }\n        ]\n    }\n}\n```\n\nNote: to have a pretty json output, you can use `python -m json.tool`:\n\n```\n\u003e curl ... | python -m json.tool\n```\n\nSee the API documentation [here](https://gribouille.github.io/documentation/jas/latest/) to have the list of \nGraphQL queries and mutations to manage the users, groups and permissions.\n\nA set of examples is available [here](./EXAMPLES.md).\n\n\n### Development\n\n_Requirement: docker, node-js and npm._\n\nCreate and initialize the PostgreSQL database with Docker:\n```\n\u003e npm run db-start\n\u003e npm run db-init\n```\n\nStart the server:\n```\n\u003e npm install\n\u003e npm run dev\n```\n\nBy default, the server is started on `http://127.0.0.1:8080`.\n\nYou can use `graphiql` with the _debug API_ on `http://\u003clocalhost\u003e:\u003cport\u003e/debug`\nto test the API without the token.\n\n### Settings\n\nYou can configure the server with these environment variables:\n\n| Variable         | Description                                |\n| ---------------- | ------------------------------------------ |\n| `JAS_PORT`       | port of server                             |\n| `JAS_DB_HOST`    | host name of postgres database             |\n| `JAS_DB_NAME`    | name of postgres database                  |\n| `JAS_DB_USER`    | user name of postgres database             |\n| `JAS_DB_PASS`    | password of postgres database              |\n| `JAS_DB_PORT`    | port number of postgres database           |\n| `JAS_TOKEN_SIGN` | secret sentence to encrypt the token       |\n| `JAS_TOKEN_ALGO` | algorithm for the token (default: `HS256`) |\n| `JAS_TOKEN_EXP`  | expiration time of token (default: `7d`).  |\n\nFor more information about the JWT options, see \n[JsonWebToken for node.js](https://github.com/auth0/node-jsonwebtoken).\n\n\n## Design\n\n- JSON Web Token\n- PostgreSQL database\n- Bcrypt\n- Docker\n- Functional javascript (see references)\n\n\n## TODO\n\n- [ ] tests\n- [ ] create init script to set the admin password\n- [ ] SSH\n\n\n## References\n\n* [RFC 7519 - JSON Web Token (JWT)](https://tools.ietf.org/html/rfc7519)\n* [RFC 6750 - The OAuth 2.0 Authorization Framework: Bearer Token Usage](https://tools.ietf.org/html/rfc6750#page-5)\n* [Fantasy Land Specification](https://github.com/fantasyland/fantasy-land)\n* [Refuge from unsafe JavaScript](https://github.com/sanctuary-js/sanctuary)\n* [Run-time type system for JavaScript](https://github.com/sanctuary-js/sanctuary-def)\n* [Standard library for Fantasy Land](https://github.com/sanctuary-js/sanctuary-type-classes)\n* [bcrypt for NodeJs](https://github.com/kelektiv/node.bcrypt.js)\n* [PostgreSQL client for node.js](https://github.com/brianc/node-postgres)\n* [Bluebird promise library](http://bluebirdjs.com)\n* [JsonWebToken implementation for node.js](https://github.com/auth0/node-jsonwebtoken)\n\n\n## Contributing\n\nFeedback and contributions are very welcome.\n\n\n## License\n\nThis project is licensed under [Mozilla Public License Version 2.0](./LICENSE).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgribouille%2Fjson-auth-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgribouille%2Fjson-auth-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgribouille%2Fjson-auth-server/lists"}