{"id":15285906,"url":"https://github.com/boywithkeyboard-archive/authenticus","last_synced_at":"2025-10-20T16:35:24.481Z","repository":{"id":172800088,"uuid":"631627618","full_name":"boywithkeyboard-archive/authenticus","owner":"boywithkeyboard-archive","description":"The simplest all-in-one authentication library for JavaScript.","archived":true,"fork":false,"pushed_at":"2024-06-18T16:33:29.000Z","size":359,"stargazers_count":34,"open_issues_count":5,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-01-17T15:06:36.695Z","etag":null,"topics":["auth","authentication","browser","cloudflare-workers","deno","discord","github","gitlab","google","javascript","node","oauth","oauth2","oauth2-client","social-login","social-media","spotify","stripe","typescript"],"latest_commit_sha":null,"homepage":"https://npmjs.com/authenticus","language":"TypeScript","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/boywithkeyboard-archive.png","metadata":{"files":{"readme":"readme.md","changelog":"changelog.md","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},"funding":{"github":"boywithkeyboard"}},"created_at":"2023-04-23T16:10:26.000Z","updated_at":"2024-06-27T00:42:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"a28b9beb-10a5-4b53-a853-bdea01246269","html_url":"https://github.com/boywithkeyboard-archive/authenticus","commit_stats":null,"previous_names":["azurystudio/authenticus","boywithkeyboard-archive/authenticus"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boywithkeyboard-archive%2Fauthenticus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boywithkeyboard-archive%2Fauthenticus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boywithkeyboard-archive%2Fauthenticus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boywithkeyboard-archive%2Fauthenticus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/boywithkeyboard-archive","download_url":"https://codeload.github.com/boywithkeyboard-archive/authenticus/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235569500,"owners_count":19011184,"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":["auth","authentication","browser","cloudflare-workers","deno","discord","github","gitlab","google","javascript","node","oauth","oauth2","oauth2-client","social-login","social-media","spotify","stripe","typescript"],"created_at":"2024-09-30T15:08:22.151Z","updated_at":"2025-10-07T01:30:19.971Z","avatar_url":"https://github.com/boywithkeyboard-archive.png","language":"TypeScript","funding_links":["https://github.com/sponsors/boywithkeyboard"],"categories":[],"sub_categories":[],"readme":"## authenticus\n\nauthenticus is a all-in-one authentication library for Node.js, Deno, Cloudflare Workers, etc.\n\n\u003e [!WARNING]  \n\u003e authenticus is no longer actively maintained, please migrate to e.g. [arctic](https://www.npmjs.com/package/arctic). If you're interested in maintaining this library, please reach out to me through my website.\n\n### Setup\n\n#### Node.js\n\n```bash\nnpm i authenticus\n```\n\n#### Deno\n\n`deno.json`\n```json\n{\n  \"imports\": {\n    \"authenticus\": \"https://esm.sh/authenticus@4.1.1\"\n  }\n}\n```\n\n### OAuth 2.0\n\n**Presets:**\n\n- [x] [Discord](https://discord.com/developers/applications)\n- [x] [GitHub](https://github.com/settings/developers)\n- [x] [Google](https://console.cloud.google.com/apis/dashboard)\n- [x] [Spotify](https://developer.spotify.com/dashboard)\n\n\u003e [!IMPORTANT]  \n\u003e You should wrap your code within a [try...catch](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/try...catch) block, as each of the methods listed below can cause an `AuthenticusError` in some rare cases.\n\n```ts\nimport { GitHub } from 'authenticus'\n```\n\n1. **Initialize client.**\n\n    ```ts\n    const github = new GitHub({\n      clientId: '...',\n      clientSecret: '...',\n      scopes: [\n        'read:user',\n        'user:email'\n      ] // optional\n    })\n    ```\n\n2. **Create a authorization url.**\n\n   ```ts\n   const url = github.createAuthorizeUri({\n     state: '...',\n     allowSignup: true\n   })\n   ```\n\n3. **Retrieve an access token.**\n\n   ```ts\n   const { accessToken } = await github.getToken({\n     code: '...',\n     redirectUri: 'https://example.com/oauth2/callback'\n   })\n   ```\n\n4. **Retrieve the user.**\n\n   ```ts\n   const user = await github.getUser(accessToken)\n\n   , normalizedUser = github.normalizeUser(user)\n   ```\n\n### JWT\n\nauthenticus' JWT implementation is based on **@timonson**'s [djwt](https://github.com/Zaubrik/djwt), which is available under the MIT license.\n\n```ts\nimport { jwt } from 'authenticus'\n\njwt.sign(...)\n```\n\nPlease refer to [this page](https://github.com/Zaubrik/djwt?tab=readme-ov-file#djwt) for a full guide.\n\n### OTP\n\nauthenticus' OTP implementation is based on **@hectorm**'s [otpauth](https://github.com/hectorm/otpauth), which is available under the MIT license.\n\n```ts\nimport { otp } from 'authenticus'\n\n// Generate a random secret.\nconst secret = otp.createRandomSecret()\n\n// Create an URI for a QR code for Google Authenticator.\nconst uri = otp.createUri(secret, 'Issuer', 'Label')\n\n// Get the current OTP.\nconst token = otp.createToken(secret)\n\n// Check the validity of a token.\nconst result = otp.isValid(secret, '\u003ctoken\u003e')\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboywithkeyboard-archive%2Fauthenticus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fboywithkeyboard-archive%2Fauthenticus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboywithkeyboard-archive%2Fauthenticus/lists"}