creating adobe access token in a headless action

Avatar

Avatar
Coach
MVP
ursboller
MVP

Likes

525 likes

Total Posts

1,020 posts

Correct reply

257 solutions
Top badges earned
Coach
Contributor
Bedrock
Seeker
Springboard
View profile

Avatar
Coach
MVP
ursboller
MVP

Likes

525 likes

Total Posts

1,020 posts

Correct reply

257 solutions
Top badges earned
Coach
Contributor
Bedrock
Seeker
Springboard
View profile
ursboller
MVP

31-08-2020

I try to create an adobe access token in a headless action. first I tryed to use aio-lib-ims but this fails to include in the action (maybe an issue with the core library and their dependencies?)

 

is there any easy way to create an adobe access token having all data in the .env file?

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Give Back 25
Employee
duypnguyen
Employee

Likes

36 likes

Total Posts

173 posts

Correct reply

32 solutions
Top badges earned
Give Back 25
Boost 25
Applaud 5
Give Back 5
Give Back 3
View profile

Avatar
Give Back 25
Employee
duypnguyen
Employee

Likes

36 likes

Total Posts

173 posts

Correct reply

32 solutions
Top badges earned
Give Back 25
Boost 25
Applaud 5
Give Back 5
Give Back 3
View profile
duypnguyen
Employee

23-09-2020

Hi @ursboller@oliverf82757722 - a new version of @adobe/aio-lib-ims has been released, which fixes the issue reported earlier. I was able to get the token using this code.

const { context, getToken } = require('@adobe/aio-lib-ims')
const config = {
      client_id: params.client_id,
      client_secret: params.client_secret,
      technical_account_email: params.technical_account_email,
      technical_account_id: params.technical_account_id,
      meta_scopes: [
        'ent_campaign_sdk'
      ],
      ims_org_id: params.ims_org_id,
      private_key: params.private_key
    };
    await context.set('my_acs', config)
    await context.setCurrent('my_acs')
    
    // get JWT access token
    const token = await getToken()

    // initialize the sdk
    const campaignClient = await CampaignStandard.init(params.tenant, params.client_id, token)

Please note that, for the value of private key, you could pass a string in this format: "-----BEGIN PRIVATE KEY-----\nmy\nprivate\nkey\n-----END PRIVATE KEY-----".

Answers (0)