{"id":18821143,"url":"https://github.com/compwright/axios-oauth-client","last_synced_at":"2025-04-03T11:10:28.717Z","repository":{"id":33014892,"uuid":"149835281","full_name":"compwright/axios-oauth-client","owner":"compwright","description":"OAuth 2.0 client utils for axios","archived":false,"fork":false,"pushed_at":"2024-10-02T17:37:03.000Z","size":1292,"stargazers_count":71,"open_issues_count":2,"forks_count":16,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-27T10:13:49.527Z","etag":null,"topics":["axios","interceptor","oauth2"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/axios-oauth-client","language":"JavaScript","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/compwright.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","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":"compwright"}},"created_at":"2018-09-22T01:29:19.000Z","updated_at":"2025-01-15T16:08:05.000Z","dependencies_parsed_at":"2023-11-11T17:29:57.713Z","dependency_job_id":"4f1100f8-4bd1-45e5-afed-24cdf2718d02","html_url":"https://github.com/compwright/axios-oauth-client","commit_stats":{"total_commits":59,"total_committers":7,"mean_commits":8.428571428571429,"dds":0.5593220338983051,"last_synced_commit":"0d9b107769b83f53bba503082196f765c4be674b"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compwright%2Faxios-oauth-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compwright%2Faxios-oauth-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compwright%2Faxios-oauth-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compwright%2Faxios-oauth-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/compwright","download_url":"https://codeload.github.com/compwright/axios-oauth-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246989746,"owners_count":20865331,"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":["axios","interceptor","oauth2"],"created_at":"2024-11-08T00:34:33.964Z","updated_at":"2025-04-03T11:10:28.701Z","avatar_url":"https://github.com/compwright.png","language":"JavaScript","readme":"# axios-oauth-client\n\nOAuth 2.0 client utils for axios\n\n## Installation\n\nWith NPM:\n\n```bash\n$ npm install --save axios-oauth-client axios\n```\n\nWith Yarn:\n\n```bash\n$ yarn add axios-oauth-client axios\n```\n\n## Axios OAuth 2.0 Client\n\n### Authorization Code grant\n\n```javascript\nimport axios from 'axios'\nimport { authorizationCode } from 'axios-oauth-client'\nconst getAuthorizationCode = authorizationCode(\n  axios.create(),\n  'https://oauth.com/2.0/token', // OAuth 2.0 token endpoint\n  'CLIENT_ID',\n  'CLIENT_SECRET',\n  'https://your-app.com/oauth-redirect' // Redirect URL for your app\n)\n\nconst auth = await getAuthorizationCode('AUTHORIZATION_CODE', 'OPTIONAL_SCOPES')\n// =\u003e { \"access_token\": \"...\", \"expires_in\": 900, ... }\n```\n\n### Owner Credentials grant\n\n```javascript\nimport axios from 'axios'\nimport { ownerCredentials } from 'axios-oauth-client'\nconst getOwnerCredentials = ownerCredentials(\n  axios.create(),\n  'https://oauth.com/2.0/token', // OAuth 2.0 token endpoint\n  'CLIENT_ID',\n  'CLIENT_SECRET'\n)\n\nconst auth = await getOwnerCredentials('USERNAME', 'PASSWORD', 'OPTIONAL_SCOPES')\n// =\u003e { \"access_token\": \"...\", \"expires_in\": 900, ... }\n```\n\n### Client Credentials grant\n\n```javascript\nimport axios from 'axios'\nimport { clientCredentials } from 'axios-oauth-client'\nconst getClientCredentials = clientCredentials(\n  axios.create(),\n  'https://oauth.com/2.0/token',\n  'CLIENT_ID',\n  'CLIENT_SECRET'\n)\n\nconst auth = await getClientCredentials('OPTIONAL_SCOPES')\n// =\u003e { \"access_token\": \"...\", \"expires_in\": 900, ... }\n```\n\n### Refresh Token grant\n\n```javascript\nimport axios from 'axios'\nimport { refreshToken } from 'axios-oauth-client'\nconst getRefreshToken = refreshToken(\n  axios.create(),\n  'https://oauth.com/2.0/token',\n  'CLIENT_ID',\n  'CLIENT_SECRET'\n)\n\nconst auth = await getRefreshToken('REFRESH_TOKEN', 'OPTIONAL_SCOPES')\n// =\u003e { \"access_token\": \"...\", \"refresh_token\": \"...\", \"expires_in\": 900, ... }\n```\n\n## License\n\nMIT\n","funding_links":["https://github.com/sponsors/compwright"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcompwright%2Faxios-oauth-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcompwright%2Faxios-oauth-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcompwright%2Faxios-oauth-client/lists"}