Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Automate JWT Token Generation

Avatar

Level 7

Hi Team,

 

We are planning to use Recommendations API to create/update Entities. 

For those API to run we need bearer token, bearer token is generated using JWT Token.

 

Both bearer and jwt token are not constant so how can we automate it ?

 

Any insight on this is reallly helpful.

 

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@LordOfTheRings  - I provided Python code to generate JWT and Access token (https://experienceleaguecommunities.adobe.com/t5/adobe-target-questions/generating-jwt-for-target-ap...)  - is this what you are after?

 

Regards

Rajneesh

View solution in original post

6 Replies

Avatar

Level 6

You can use client secrets to generate a new bearer token each time before the API request.

 

There are several scripts - for JWT encode and decode. Depending on which language you want to use.

I myself use this automated in combination with CI/CD pipelines with docker images and in bash.

Avatar

Level 7

Hi @perrin_ennen  in order to generate the bearer token (to used in API) I would need JWT token.

JWT token has the expiry so how do I generate it programmatically using keys ?

API Team doesnt have the UI access but I can share with them the API and private key.

Avatar

Level 6

You can do the JWT token generation manually in the UI. But it is also possible to automate this yourself.

 

Here is an article how it works with Bash: Generate JWT With Bash 

Something like this exists for other programming languages as well.

Avatar

Correct answer by
Community Advisor

@LordOfTheRings  - I provided Python code to generate JWT and Access token (https://experienceleaguecommunities.adobe.com/t5/adobe-target-questions/generating-jwt-for-target-ap...)  - is this what you are after?

 

Regards

Rajneesh