• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Obtaining JWT with API request

New Here ,
Oct 12, 2022 Oct 12, 2022

Copy link to clipboard

Copied

  1. Is there a way to obtain the JWT token via API, in a single call, without using Node, Java or PHP? (ex.  Postman)
  2. Which is the correct metaScopes to use into the config.js in Node JWT test, when using PDF Services API? I tried with metaScopes : "ent_user_sdk" but it's wrong and don't understand why.

 

Thanks

Views

465

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Oct 12, 2022 Oct 12, 2022

Copy link to clipboard

Copied

I believe you want this: 

 
Here's a Python func that gets the access token - technically not the JWT, but if you are trying to call the new REST APIs, this will work:
 
def getAccessToken(creds):
	url = "https://ims-na1.adobelogin.com/ims/exchange/jwt"

	jwtPayloadRaw = f"""
	{{ 
		"iss": "{creds['org_id']}",
		"sub": "{creds['technical_account_id']}",
		"https://ims-na1.adobelogin.com/s/ent_documentcloud_sdk": true,
		"aud": "https://ims-na1.adobelogin.com/c/{creds['client_id']}" 
	}}
	"""

	jwtPayloadJson = json.loads(jwtPayloadRaw)
	jwtPayloadJson["exp"] = datetime.datetime.utcnow() + datetime.timedelta(seconds=30)

	accessTokenRequestPayload = {
		'client_id': creds['client_id'],
		'client_secret': creds['client_secret']
	}


	jwttoken = jwt.encode(jwtPayloadJson, KEY, algorithm='RS256')

	accessTokenRequestPayload['jwt_token'] = jwttoken
	result = requests.post(url, data = accessTokenRequestPayload)
	resultjson = json.loads(result.text)

	return resultjson['access_token']
 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 26, 2023 Feb 26, 2023

Copy link to clipboard

Copied

I tried the above, but it always gives error 'Could not deserialize key data. The data may be in an incorrect format or it may be encrypted with an unsupported algorithm'

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Feb 27, 2023 Feb 27, 2023

Copy link to clipboard

Copied

LATEST

If you dumnp out result.text, what do you see?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources