AnsweredAssumed Answered

Python API Help

Question asked by John Craig on Apr 8, 2020
Latest reply on Apr 22, 2020 by Erica Chalfin

Hello, I am writing an API in python using JWT for our SEIM. I am receiving an error: {'timestamp': 1586368426770, 'status': 403, 'error': 'Forbidden', 'message': 'java.text.ParseException: Invalid serialized unsecured/JWS/JWE object: Missing part delimiters', 'path': '/AdminInterface/restapi/v1/usereventlog/exportlogs'}. My code is as follows:

 

import jwt
from datetime import datetime, timedelta
import json
import requests
jwt.encode({'sub': '<key>',
'iat': datetime.utcnow(),
'exp': datetime.utcnow() + timedelta(minutes=45),
'aud': 'https://na3.access.securid.com/AdminInterface/restapi/'}, '<secrect>', headers={'typ': 'JWT','alg': 'RS256'})
url='https://na3.access.securid.com/AdminInterface/restapi/v1/usereventlog/exportlogs'
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer jwt_encode'
}
response = requests.get(url, headers=headers).json()
print(response)

 

Any assistance would be great.

 

Thanks

Outcomes