Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rocky-jaiswal/auth-service
Generic Auth / JWT service
https://github.com/rocky-jaiswal/auth-service
Last synced: about 1 month ago
JSON representation
Generic Auth / JWT service
- Host: GitHub
- URL: https://github.com/rocky-jaiswal/auth-service
- Owner: rocky-jaiswal
- Created: 2022-03-05T10:30:12.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-09-30T16:20:45.000Z (about 1 year ago)
- Last Synced: 2024-06-12T18:56:07.577Z (6 months ago)
- Language: TypeScript
- Size: 1.01 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Auth Service
## What is this?
Basically a fast Node.js based JWT service, which also supports Google OAuth. I use it for a lot of personal projects to solve authentication.
## Setup
1. Run `node bin/generateKeyPair.mjs ` to generate JWT signing keys and update src/public/.well-known -> "jwks.json"
2. Copy secret omitted from command above (keyid & key password) in "secrets/<_environment_>.env" (e.g. secrets/development.env)
3. Generate a strong secret/password somehow (e.g. `crypto.randomUUID().replaceAll('-', '').substring(0, 16)`)
4. Run `node bin/lockSecret.mjs ` to encrypt secrets, use secret/password from step 3 here (encryption uses Node GPG)
5. Run DB with `docker-compose up --build`
6. Run `just dev` to start service in dev mode (DB is already running on docker)
7. For testing make sure DB is up (via docker-compose) and run `just test`## Common HTTP requests (using HTTPIE)
- `http POST http://localhost:9090/v1/users email="[email protected]" password="123456" confirmedPassword="123456"`
- `http POST http://localhost:9090/v1/sessions email="[email protected]" password="123456"`
- `http GET http://localhost:9090/v1/user authorization:"token "`