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

  1. git clone https://github.com/AdobeDocs/adobeio-auth.git
  2. Edit the config files and add API Key, Client Secret, Org ID, Technical Account ID and Private key from your Adobe Developer Console integration.

  3. cd into the directory with package.json and run npm install
  4. Find the index.js file in node_modules/@adobe/jwt-auth/index.js

  5. Change jwtPayload exp property to 31556952000 so the object looks like this

  6. const jwtPayload = { exp: 31556952000, iss: orgId, sub: technicalAccountId, aud: `${ims}/c/${clientId}` };
  7. And add a print out after the

  8. This will print out the JWT token when running the script

  9. finally run the script:

    ย 

  10. 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

ย 

ย 

Reference: https://www.adobe.io/authentication/auth-methods.html#!AdobeDocs/adobeio-auth/master/AuthenticationOverview/ServiceAccountIntegration.md