Adobe - Get JWT token
Step 1: Create a project in Adobe Developer Console
Integrations are now created as part of a "project" within Adobe Developer Console. For complete steps to creating a project in Console, begin by reading theย Adobe Developer Console getting started guideย andย projects overview.
Once you have created a project, you will be able to add services including APIs, Adobe I/O Events registrations, and Adobe I/O Runtime.
Step 2: Add an API to your project using Service Account authentication
To add an API that uses Service Account (JWT) authentication, follow the steps outlined in the guide forย adding an API to a project using Service Account authentication.
During the API configuration process, you will be able to generate a key pair and download the private key.
Note the JWT generate on the web will expire after 1 day, thats were the Step 4 is needed.
ย
Step 3: Generate a 1 year JWT
Here is were it gets a bit tech sawy since the Adobe web UI only support 1 day token, you need to expand that to your choice like 1 year.
Perform these task
git clone https://github.com/AdobeDocs/adobeio-auth.git
Edit the config files and add API Key, Client Secret, Org ID, Technical Account ID and Private key from your Adobe Developer Console integration.
cd into the directory with package.json and run npm install
Find the index.js file in node_modules/@adobe/jwt-auth/index.js
Change jwtPayload exp property to 31556952000 so the object looks like this
const jwtPayload = { exp: 31556952000, iss: orgId, sub: technicalAccountId, aud: `${ims}/c/${clientId}` };
And add a print out after the
This will print out the JWT token when running the script
finally run the script:
ย
Copy the JWT token from the print out (not the access token) you will use this i iHub.
ย
More info adobeio-auth/JWT/samples/adobe-jwt-node at stage ยท AdobeDocs/adobeio-auth
Step 4: Exchange the JWT to access token and perform work
ย
ย