Expand my Community achievements bar.

SOLVED

Automate JWT Token Generation

Avatar

Community Advisor

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

@ambikaTewari_ATCI  - 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

Community Advisor

Found this https://developer.adobe.com/developer-console/docs/guides/authentication/JWT/samples/

 

does it talk about the script (in different languages) to programmatically automate the JWT token ?

Avatar

Community Advisor

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

Community Advisor

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

Community Advisor

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

@ambikaTewari_ATCI  - 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

Avatar

Community Advisor

yes @Rajneesh_Gautam_ I'll try this.

 I got this help doc (https://developer.adobe.com/developer-console/docs/guides/authentication/JWT/samples/) also which talks about the scripts in different languages to automate the JWT generation .