From 624b5aae7e3c1ebaebdc3a9d3ed92bf25552de6b Mon Sep 17 00:00:00 2001 From: suarezry Date: Tue, 13 Oct 2020 10:25:10 -0400 Subject: [PATCH] instantiate jwtPayloadJson directly instead of instantiating string first then convert to json --- JWT/samples/adobe-jwt-python/jwtencode.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/JWT/samples/adobe-jwt-python/jwtencode.py b/JWT/samples/adobe-jwt-python/jwtencode.py index c6b6550..46d1c2f 100644 --- a/JWT/samples/adobe-jwt-python/jwtencode.py +++ b/JWT/samples/adobe-jwt-python/jwtencode.py @@ -6,15 +6,14 @@ # Config Data url = 'https://ims-na1.adobelogin.com/ims/exchange/jwt' -jwtPayloadRaw = """{ "iss": "{The issuer, your Organization ID from the Adobe Developer Console integration, in the format org_ident@AdobeOrg}", +jwtPayloadJson = { "iss": "{The issuer, your Organization ID from the Adobe Developer Console integration, in the format org_ident@AdobeOrg}", "sub": "{The subject, your Technical Account ID from the Adobe Developer Console integration, in the format: id@techacct.adobe.com}", "{The API-access claim configured for your organization: https://ims-na1.adobelogin.com/s/ent_analytics_bulk_ingest_sdk}": true, - "aud": "{The audience for the token, your API Key from the Adobe Developer Console integration, in the format: https://ims-na1.adobelogin.com/c/api_key}" }""" -jwtPayloadJson = json.loads(jwtPayloadRaw) -jwtPayloadJson["exp"] = datetime.datetime.utcnow() + datetime.timedelta(seconds=30) + "aud": "{The audience for the token, your API Key from the Adobe Developer Console integration, in the format: https://ims-na1.adobelogin.com/c/api_key}", + "exp": datetime.datetime.utcnow() + datetime.timedelta(seconds=30) } -accessTokenRequestPayload = {'client_id': '{Your Client Id (API Key)}' - ,'client_secret': 'Your Client Secret'} +accessTokenRequestPayload = { 'client_id': '{Your Client Id (API Key)}', + 'client_secret': 'Your Client Secret' } # Request Access Key #This Needs to point at where your private key is on the file system