{"id":13527252,"url":"https://github.com/adobe/jwt-auth","last_synced_at":"2025-04-01T09:31:20.013Z","repository":{"id":34240680,"uuid":"171566496","full_name":"adobe/jwt-auth","owner":"adobe","description":"Retrieve an authorization token from Adobe via JSON Web Token","archived":false,"fork":false,"pushed_at":"2024-04-08T12:49:16.000Z","size":215,"stargazers_count":17,"open_issues_count":11,"forks_count":14,"subscribers_count":30,"default_branch":"master","last_synced_at":"2025-03-03T02:38:14.526Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adobe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"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}},"created_at":"2019-02-19T23:27:19.000Z","updated_at":"2024-10-25T15:01:37.000Z","dependencies_parsed_at":"2024-01-13T21:40:05.465Z","dependency_job_id":"f55980b9-a576-490d-a2a6-c4d3f180995c","html_url":"https://github.com/adobe/jwt-auth","commit_stats":{"total_commits":70,"total_committers":14,"mean_commits":5.0,"dds":0.4571428571428572,"last_synced_commit":"9cd947f720a11ac67a601bcb6988a3b702617d47"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adobe%2Fjwt-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adobe%2Fjwt-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adobe%2Fjwt-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adobe%2Fjwt-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adobe","download_url":"https://codeload.github.com/adobe/jwt-auth/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246616074,"owners_count":20806049,"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":[],"created_at":"2024-08-01T06:01:44.178Z","updated_at":"2025-04-01T09:31:19.671Z","avatar_url":"https://github.com/adobe.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"[![Version](https://img.shields.io/npm/v/@adobe/jwt-auth.svg)](https://npmjs.org/package/@adobe/jwt-auth)\n[![Downloads/week](https://img.shields.io/npm/dw/@adobe/jwt-auth.svg)](https://npmjs.org/package/@adobe/jwt-auth)\n[![codecov](https://codecov.io/gh/adobe/jwt-auth/branch/master/graph/badge.svg)](https://codecov.io/gh/adobe/jwt-auth)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n[![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/adobe/jwt-auth.svg?logo=lgtm\u0026logoWidth=18)](https://lgtm.com/projects/g/adobe/jwt-auth/context:javascript)\n\n# jwt-auth\n\nRetrieve an Adobe bearer token via the JWT path\n\n## Goals\n\nInstead of every developer who wants to use the JWT Auth flow to retrieve an auth token from Adobe having to write their own implementation of this flow this package is intended to replace this need with one method call.\n\n### Installation\n\nInstructions for how to download/install the code onto your machine.\n\nExample:\n\n```\nnpm install @adobe/jwt-auth\n```\n\n### Common Usage\n\nUsage instructions for your code.\n\nPromise based example:\n\n```javascript\nconst auth = require(\"@adobe/jwt-auth\");\n\nauth(config)\n  .then((tokenResponse) =\u003e console.log(tokenResponse))\n  .catch((error) =\u003e console.log(error));\n```\n\nAsync/Await based example:\n\n```javascript\nconst auth = require(\"@adobe/jwt-auth\");\n\nlet tokenResponse = await auth(config);\nconsole.log(tokenResponse);\n```\n\nor (if you don't care about the other properties in the token response)\n\n```javascript\nconst auth = require(\"@adobe/jwt-auth\");\n\nlet { access_token } = await auth(config);\nconsole.log(access_token);\n```\n\n#### Config object\n\nThe config object is where you pass in all the required and optional parameters to the `auth` call.\n\n| parameter          | integration name     | required | type                              | default                        |\n| ------------------ | -------------------- | -------- | --------------------------------- | ------------------------------ |\n| clientId           | API Key (Client ID)  | true     | String                            |                                |\n| technicalAccountId | Technical account ID | true     | String                            |                                |\n| orgId              | Organization ID      | true     | String                            |                                |\n| clientSecret       | Client secret        | true     | String                            |                                |\n| privateKey         |                      | true     | String                            |                                |\n| passphrase         |                      | false    | String                            |                                |\n| metaScopes         |                      | true     | Comma separated Sting or an Array |                                |\n| ims                |                      | false    | String                            | https://ims-na1.adobelogin.com |\n\nIn order to determine which **metaScopes** you need to register for you can look them up by product in this [handy table](https://www.adobe.io/authentication/auth-methods.html#!AdobeDocs/adobeio-auth/master/JWT/Scopes.md).\n\nFor instance if you need to be authenticated to call API's for both GDPR and User Management you would [look them up](https://www.adobe.io/authentication/auth-methods.html#!AdobeDocs/adobeio-auth/master/JWT/Scopes.md) and find that they are:\n\n- GDPR: https://ims-na1.adobelogin.com/s/ent_gdpr_sdk\n- User Management: https://ims-na1.adobelogin.com/s/ent_user_sdk\n\nThey you would create an array of **metaScopes** as part of the config object. For instance:\n\n```javascript\nconst config = {\n  clientId: \"asasdfasf\",\n  clientSecret: \"aslfjasljf-=asdfalasjdf==asdfa\",\n  technicalAccountId: \"asdfasdfas@techacct.adobe.com\",\n  orgId: \"asdfasdfasdf@AdobeOrg\",\n  metaScopes: [\n    \"https://ims-na1.adobelogin.com/s/ent_gdpr_sdk\",\n    \"https://ims-na1.adobelogin.com/s/ent_user_sdk\",\n  ],\n};\n```\n\nHowever, if you omit the IMS url the package will automatically add it for you when making the call to generate the JWT. For example:\n\n```javascript\nconst config = {\n  clientId: \"asasdfasf\",\n  clientSecret: \"aslfjasljf-=asdfalasjdf==asdfa\",\n  technicalAccountId: \"asdfasdfas@techacct.adobe.com\",\n  orgId: \"asdfasdfasdf@AdobeOrg\",\n  metaScopes: [\"ent_gdpr_sdk\", \"ent_user_sdk\"],\n};\n```\n\nThis is the recommended approach.\n\n#### Response Object\n\nThe response object contains three keys:\n\n- `token_type`\n- `access_token`\n- `expires_in`\n\n#### Example\n\n```javascript\nconst auth = require(\"@adobe/jwt-auth\");\nconst fs = require(\"fs\");\n\nconst config = {\n  clientId: \"asasdfasf\",\n  clientSecret: \"aslfjasljf-=asdfalasjdf==asdfa\",\n  technicalAccountId: \"asdfasdfas@techacct.adobe.com\",\n  orgId: \"asdfasdfasdf@AdobeOrg\",\n  metaScopes: [\"ent_dataservices_sdk\"],\n};\nconfig.privateKey = fs.readFileSync(\"private.key\");\n\nauth(config)\n  .then((token) =\u003e console.log(token))\n  .catch((error) =\u003e console.log(error));\n```\n\n### Contributing\n\nContributions are welcomed! Read the [Contributing Guide](.github/CONTRIBUTING.md) for more information.\n\n### Licensing\n\nThis project is licensed under the Apache V2 License. See [LICENSE](LICENSE) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadobe%2Fjwt-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadobe%2Fjwt-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadobe%2Fjwt-auth/lists"}