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

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

50

Likes

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

LATEST

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']
 

Likes

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