Hi Team,
I generate Credential ID and Token via StreamSets UI → Manage → API Credential, and with the generated ID and Token I can run Curl command, returned status is “HTTP/1.1 200 OK”, also return me a json format that show my organization id, email, extra..
However, When I want to connect with below code snippet (using same credential ID and Token), it returns me error of 403. paste code and error below:
>>> from streamsets.sdk import ControlHub
>>> sch = ControlHub(credential_id='absd_myid', token="abcd_mytoken.")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/module/sfsdcvenv/lib/python3.8/site-packages/streamsets/sdk/sch.py", line 141, in __init__
self.api_client = sch_api.ApiClient(
File "/opt/module/sfsdcvenv/lib/python3.8/site-packages/streamsets/sdk/sch_api.py", line 96, in __init__
raise ValueError('Encountered error while decoding auth token: {}'.format(e))
ValueError: Encountered error while decoding auth token: 403 Client Error: Forbidden for url: https://cloud.login.streamsets.com/api/security/public/v3/orgs/e892013-fe1345-11ee-87ac-05dc62art4c4/info
Paste curl return json for reference:
{"tokenStr":"","issuerUrl":null,"expires":-1713929547936,"principalId":"e3cb72c9-fe1a-11ee-87ac-bd50c19cc8de@e725089d-fe1b-11ee-87ac-05dc62a798c4","principalName":"API(SDC_CREDENTIAL) - xxx xx","organizationId":"e892013-fe1345-11ee-87ac-05dc62art4c4","organizationName":"Netsaee","email":"dfwer@123.com","roles":w"connection:user","org-admin","datacollector:admin","datacollector:manager","jobrunner:operator","pipelinestore:pipelineEditor","org-user","pipelinestore:rulesEditor","datacollector:creator","user","pipelinestore:user"],"groups":t"all@e456778-gh1b-11ee-87er-05dc62a798c4"],"app":false,"attributes":{"component.type":"api-user"}}n