{"id":20880092,"url":"https://github.com/rocky-jaiswal/auth-service","last_synced_at":"2026-04-29T04:07:42.365Z","repository":{"id":139259465,"uuid":"466421122","full_name":"rocky-jaiswal/auth-service","owner":"rocky-jaiswal","description":"Generic Auth / JWT service","archived":false,"fork":false,"pushed_at":"2026-01-22T16:25:24.000Z","size":1222,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-23T09:20:43.283Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"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/rocky-jaiswal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-03-05T10:30:12.000Z","updated_at":"2026-01-22T16:25:28.000Z","dependencies_parsed_at":"2023-09-30T17:40:54.106Z","dependency_job_id":null,"html_url":"https://github.com/rocky-jaiswal/auth-service","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rocky-jaiswal/auth-service","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rocky-jaiswal%2Fauth-service","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rocky-jaiswal%2Fauth-service/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rocky-jaiswal%2Fauth-service/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rocky-jaiswal%2Fauth-service/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rocky-jaiswal","download_url":"https://codeload.github.com/rocky-jaiswal/auth-service/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rocky-jaiswal%2Fauth-service/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32410011,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T03:46:11.172Z","status":"ssl_error","status_checked_at":"2026-04-29T03:37:55.317Z","response_time":110,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":[],"created_at":"2024-11-18T07:19:00.249Z","updated_at":"2026-04-29T04:07:42.360Z","avatar_url":"https://github.com/rocky-jaiswal.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Auth Service\n\n## What is this?\n\nBasically a fast Node.js based JWT service, which also supports Google OAuth and Microsoft OAuth. I use it for a lot of personal projects to solve authentication.\n\n## Setup\n\n1. Run `node bin/generateKeyPair.mjs \u003cenvironment\u003e` to generate JWT signing keys and update src/public/.well-known -\u003e \"jwks.json\"\n2. Copy secret omitted from command above (keyid \u0026 key password) in \"secrets/\u003c_environment_\u003e.env\" (e.g. secrets/development.env)\n3. Generate a strong secret/password somehow (e.g. `crypto.randomUUID().replaceAll('-', '').substring(0, 16)`)\n4. Run `node bin/lockSecret.mjs \u003cenvironment\u003e \u003csecret\u003e` to encrypt secrets, use secret/password from step 3 here (encryption uses Node GPG)\n\n## Environment Variables\n\nRequired for basic functionality:\n- `AUTH_SERVER_PORT` - Server port (default: 3001)\n- `NODE_ENV` - Environment (development/test/production)\n- `DB_CONN` - PostgreSQL connection string\n- `KEY_SUFFIX` - Key file suffix (_development, _production)\n- `KEY_SECRET` - Private key passphrase\n- `KEY_ID` - JWT key ID claim\n\nRequired for Google OAuth:\n- `GOOGLE_CLIENT_ID` - Google OAuth client ID\n- `GOOGLE_CLIENT_SECRET` - Google OAuth client secret\n- `GOOGLE_CALLBACK_URI` - OAuth callback URL\n\nRequired for Microsoft OAuth:\n- `MICROSOFT_CLIENT_ID` - Azure AD application client ID\n- `MICROSOFT_CLIENT_SECRET` - Azure AD application client secret\n- `MICROSOFT_TENANT_ID` - Azure AD tenant ID (or 'common' for multi-tenant)\n- `MICROSOFT_CALLBACK_URI` - OAuth callback/redirect URI\n\n## OAuth Flow\n\n### Google OAuth:\n1. Get authorization URL: `http GET http://localhost:9090/v1/login/google/url`\n2. Redirect user to the returned URL\n3. After user authorizes, exchange code for JWT: `http POST http://localhost:9090/v1/login/google code=\"\u003cauthorization_code\u003e\"`\n\n### Microsoft OAuth:\n1. Get authorization URL: `http GET http://localhost:9090/v1/login/microsoft/url`\n2. Redirect user to the returned URL\n3. After user authorizes, exchange code for JWT: `http POST http://localhost:9090/v1/login/microsoft code=\"\u003cauthorization_code\u003e\"`\n\n## Common HTTP requests (using HTTPIE)\n\n### User Management:\n- Create user: `http POST http://localhost:9090/v1/users email=\"ryan@example.com\" password=\"123456\" confirmedPassword=\"123456\"`\n- Login: `http POST http://localhost:9090/v1/sessions email=\"ryan@example.com\" password=\"123456\"`\n- Get user info: `http GET http://localhost:9090/v1/user authorization:\"Bearer \u003cjwt\u003e\"`\n\n### OAuth:\n- Get Google auth URL: `http GET http://localhost:9090/v1/login/google/url`\n- Exchange Google code: `http POST http://localhost:9090/v1/login/google code=\"\u003cauthorization_code\u003e\"`\n- Get Microsoft auth URL: `http GET http://localhost:9090/v1/login/microsoft/url`\n- Exchange Microsoft code: `http POST http://localhost:9090/v1/login/microsoft code=\"\u003cauthorization_code\u003e\"`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frocky-jaiswal%2Fauth-service","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frocky-jaiswal%2Fauth-service","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frocky-jaiswal%2Fauth-service/lists"}