{"id":20196306,"url":"https://github.com/authorizerdev/authorizer-js","last_synced_at":"2025-08-21T07:17:27.286Z","repository":{"id":36956134,"uuid":"387171147","full_name":"authorizerdev/authorizer-js","owner":"authorizerdev","description":"Universal javaScript SDK for Authorizer API","archived":false,"fork":false,"pushed_at":"2024-05-10T14:09:00.000Z","size":972,"stargazers_count":25,"open_issues_count":1,"forks_count":8,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-07-22T12:42:48.270Z","etag":null,"topics":["hacktoberfest"],"latest_commit_sha":null,"homepage":"","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/authorizerdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","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":"authorizerdev"}},"created_at":"2021-07-18T12:32:11.000Z","updated_at":"2025-02-11T21:35:22.000Z","dependencies_parsed_at":"2023-10-13T08:33:30.251Z","dependency_job_id":"667f561f-7fb5-46c4-bf20-94860f30dece","html_url":"https://github.com/authorizerdev/authorizer-js","commit_stats":{"total_commits":146,"total_committers":5,"mean_commits":29.2,"dds":"0.17808219178082196","last_synced_commit":"f0c17e29b06a33c037a1e682c97b996777434964"},"previous_names":[],"tags_count":32,"template":false,"template_full_name":null,"purl":"pkg:github/authorizerdev/authorizer-js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/authorizerdev%2Fauthorizer-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/authorizerdev%2Fauthorizer-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/authorizerdev%2Fauthorizer-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/authorizerdev%2Fauthorizer-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/authorizerdev","download_url":"https://codeload.github.com/authorizerdev/authorizer-js/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/authorizerdev%2Fauthorizer-js/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271442268,"owners_count":24760353,"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","status":"online","status_checked_at":"2025-08-21T02:00:08.990Z","response_time":74,"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":["hacktoberfest"],"created_at":"2024-11-14T04:23:12.287Z","updated_at":"2025-08-21T07:17:27.265Z","avatar_url":"https://github.com/authorizerdev.png","language":"TypeScript","readme":"# Authorizer.js\n\n[`@authorizerdev/authorizer-js`](https://www.npmjs.com/package/@authorizerdev/authorizer-js) is universal javaScript SDK for Authorizer API.\nIt supports:\n\n- [UMD (Universal Module Definition)](https://github.com/umdjs/umd) build for browsers\n- [CommonJS(cjs)](https://flaviocopes.com/commonjs/) build for NodeJS version that don't support ES Modules\n- [ESM (ES Modules)](https://hacks.mozilla.org/2018/03/es-modules-a-cartoon-deep-dive/) build for modern javascript standard, i.e. ES Modules\n\n# Migration Guide from 1.x -\u003e 2.x\n\n`2.x` version of `@authorizerdev/authorizer-js` has a uniform response structure that will help your applications to get right error codes and success response. Methods here have `{data, errors}` as response objects for methods of this library.\n\nFor `1.x` version of this library you can get only data in response and error would be thrown so you had to handle that in catch.\n\n---\n\nAll the above versions require `Authorizer` instance to be instantiated and used. Instance constructor requires an object with the following keys\n\n| Key             | Description                                                                  |\n| --------------- | ---------------------------------------------------------------------------- |\n| `authorizerURL` | Authorizer server endpoint                                                   |\n| `redirectURL`   | URL to which you would like to redirect the user in case of successful login |\n\n**Example**\n\n```js\nconst authRef = new Authorizer({\n  authorizerURL: 'https://app.herokuapp.com',\n  redirectURL: window.location.origin,\n});\n```\n\n## IIFE\n\n- Step 1: Load Javascript using CDN\n\n```html\n\u003cscript src=\"https://unpkg.com/@authorizerdev/authorizer-js/lib/authorizer.min.js\"\u003e\u003c/script\u003e\n```\n\n- Step 2: Use the library to instantiate `Authorizer` instance and access [various methods](/authorizer-js/functions)\n\n```html\n\u003cscript type=\"text/javascript\"\u003e\n  const authorizerRef = new authorizerdev.Authorizer({\n    authorizerURL: `AUTHORIZER_URL`,\n    redirectURL: window.location.origin,\n    clientID: 'YOUR_CLIENT_ID', // can be obtained from authorizer dashboard\n  });\n\n  // use the button selector as per your application\n  const logoutBtn = document.getElementById('logout');\n  logoutBtn.addEventListener('click', async function () {\n    await authorizerRef.logout();\n    window.location.href = '/';\n  });\n\n  async function onLoad() {\n    const { data, errors } = await authorizerRef.authorize({\n      response_type: 'code',\n      use_refresh_token: false,\n    });\n    if (data \u0026\u0026 data.access_token) {\n      // get user profile using the access token\n      const { data: user, errors } = await authorizerRef.getProfile({\n        Authorization: `Bearer ${res.access_token}`,\n      });\n\n      // \tlogoutSection.classList.toggle('hide');\n      // \tuserSection.innerHTML = `Welcome, ${user.email}`;\n    }\n  }\n  onLoad();\n\u003c/script\u003e\n```\n\n## CommonJS\n\n- Step 1: Install dependencies\n\n```sh\nnpm i --save @authorizerdev/authorizer-js\nOR\nyarn add @authorizerdev/authoirzer-js\n```\n\n- Step 2: Import and initialize the authorizer instance\n\n```js\nconst { Authorizer } = require('@authorizerdev/authoirzer-js');\n\nconst authRef = new Authorizer({\n  authorizerURL: 'https://app.heroku.com',\n  redirectURL: 'http://app.heroku.com/app',\n});\n\nasync function main() {\n  await authRef.login({\n    email: 'foo@bar.com',\n    password: 'test',\n  });\n}\n```\n\n## ES Modules\n\n- Step 1: Install dependencies\n\n```sh\nnpm i --save @authorizerdev/authorizer-js\nOR\nyarn add @authorizerdev/authorizer-js\n```\n\n- Step 2: Import and initialize the authorizer instance\n\n```js\nimport { Authorizer } from '@authorizerdev/authorizer-js';\n\nconst authRef = new Authorizer({\n  authorizerURL: 'https://app.heroku.com',\n  redirectURL: 'http://app.heroku.com/app',\n});\n\nasync function main() {\n  await authRef.login({\n    email: 'foo@bar.com',\n    password: 'test',\n  });\n}\n```\n\n## Local Development Setup\n\n### Prerequisites\n\n- [Pnpm](https://pnpm.io/installation)\n- [NodeJS](https://nodejs.org/en/download/)\n\n### Setup\n\n- Clone the repository\n- Install dependencies using `pnpm install`\n- Run `pnpm build` to build the library\n- Run `pnpm test` to run the tests\n\n### Release\n\n- Run `pnpm release` to release a new version of the library\n","funding_links":["https://github.com/sponsors/authorizerdev"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauthorizerdev%2Fauthorizer-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fauthorizerdev%2Fauthorizer-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauthorizerdev%2Fauthorizer-js/lists"}