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
BedrockMission!

Learn More

View all

Sign in to view all badges

Generating JWT for Target API

Avatar

Avatar
Validate 10
Level 2
sagil23995776
Level 2

Likes

17 likes

Total Posts

32 posts

Correct Reply

4 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 10
View profile

Avatar
Validate 10
Level 2
sagil23995776
Level 2

Likes

17 likes

Total Posts

32 posts

Correct Reply

4 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 10
View profile
sagil23995776
Level 2

26-07-2019

Hi,

I've followed the steps to generate JWT token from Adobe I/O and then exchange it with Access Token.

It's working as expected but the expiration of the token is set for 24 hours.

After 24 hours I need to generate a new JWT token and Access token.

Since I need to generate it every day is there a way to do it programmatically or ser a process to refresh it?

Thanks,

Sagi

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Contributor
Level 4
rajneesh_gautam
Level 4

Likes

64 likes

Total Posts

68 posts

Correct Reply

12 solutions
Top badges earned
Contributor
Ignite 5
Ignite 3
Ignite 1
Validate 1
View profile

Avatar
Contributor
Level 4
rajneesh_gautam
Level 4

Likes

64 likes

Total Posts

68 posts

Correct Reply

12 solutions
Top badges earned
Contributor
Ignite 5
Ignite 3
Ignite 1
Validate 1
View profile
rajneesh_gautam
Level 4

06-08-2019

Hi Sagil - here is Python code to generate JWT token:

# expiry time as 24 hours

expiry_time = int(time.time()) + 60*60*24

ims_host = 'ims-na1.adobelogin.com'

ims_endpoint_jwt = '/ims/exchange/jwt/'

# create payload

payload = {

    'exp' : expiry_time,

    'iss' : <YOUR-ADOBE-ORG-ID>,

    'sub' : <YOUR-TEST-ACCOUNT-ID>,

    'https://ims-na1.adobelogin.com/s/ent_marketing_sdk': True,   

    'aud' : "https://" + ims_host + "/c/" + <API-KEY-OF-ADOBE-IO-INTEGRATION>

}

# Read the private key we will use to sign the JWT.

priv_key_file = open(<PRIVATE-KEY-PATH>)

priv_key = priv_key_file.read()

priv_key_file.close()

# create JSON Web Token, signing it with the private key.

jwt_token = jwt.encode(payload, priv_key, algorithm='RS256')

# decode bytes into string

jwt_token = jwt_token.decode("utf-8")

Hope this helps,

Rajneesh

Answers (2)

Answers (2)

Avatar

Avatar
Coach
Employee
mikewebguy
Employee

Likes

630 likes

Total Posts

402 posts

Correct Reply

85 solutions
Top badges earned
Coach
Contributor
Shape 25
Shape 1
Shape 10
View profile

Avatar
Coach
Employee
mikewebguy
Employee

Likes

630 likes

Total Posts

402 posts

Correct Reply

85 solutions
Top badges earned
Coach
Contributor
Shape 25
Shape 1
Shape 10
View profile
mikewebguy
Employee

05-08-2019

sagil23995776​,

Unfortunately for security purposes it needs to be re-generated every 24hrs.

Mihnea Docea | Technical Support Consultant | Customer Experience | Adobe | (:: 1 (800) 497-0335

Avatar

Avatar
Level 1
najls1
Level 1

Likes

0 likes

Total Posts

1 post

Correct Reply

0 solutions
View profile

Avatar
Level 1
najls1
Level 1

Likes

0 likes

Total Posts

1 post

Correct Reply

0 solutions
View profile
najls1
Level 1

04-09-2019

I'm trying to do this exact same thing but in C# .NET. You wouldn't happen to have an example for that as well?