So here is what Iâm doing while getting an user within a microservice:
I query against C8Y_BASEURL + '/application/currentApplication/subscriptions with Authorization Header:
base64_credentials(C8Y_BOOTSTRAP_TENANT, C8Y_BOOTSTRAP_USER, C8Y_BOOTSTRAP_PASSWORD)
The output of this call:
2022-08-16 10:39:37,396 - Authentication - INFO - Logger for authentication was initialised
2022-08-16 10:39:37,396 - Authentication - INFO - Starting get_authorization
2022-08-16 10:39:37,396 - Authentication - INFO - Returning t15058219/servicebootstrap_decoder:SOMERANDOMPASSWORD
2022-08-16 10:39:37,456 - Authentication - INFO - [{'password': 'SOMERANDOMPASSWORD', 'name': 'service_decoder', 'tenant': 't15058219'}]
2022-08-16 10:39:37,456 - Authentication - INFO - Returning t15058219/service_decoder: SOMERANDOMPASSWORD
2022-08-16 10:39:37,456 - Authentication - INFO - Got auth: Basic SOMEBASE64ENCODEDTHING
2022-08-16 10:39:37,456 - Authentication - INFO - Getting tenantID
2022-08-16 10:39:37,457 - Authentication - INFO - TenantID is: t15058219
2022-08-16 10:39:37,457 - Authentication - INFO - Getting Base URL
2022-08-16 10:39:37,457 - Authentication - INFO - Base URL is: http://cumulocity:8111
The requests Iâm applying against e.g. the identity API with:
t15058219/service_decoder: SOMERANDOMPASSWORD
does not work. Tested other API´s as well.
The log output for the request that is not working is:
2022-08-16 10:48:14,670 - Inventory API - INFO - Checking if external ID exists
2022-08-16 10:48:14,670 - Inventory API - INFO - Sending data to the following url: http://cumulocity:8111/identity/externalIds/c8y_Serial/67fzktfb75de6ud6n6edd6586f
2022-08-16 10:48:14,670 - Inventory API - INFO - The entry Authorization in the header is as following: Basic SOMEBASE64ENCODEDTHING
2022-08-16 10:48:14,670 - Inventory API - INFO - The entry Content-Type in the header is as following: application/json
2022-08-16 10:48:14,670 - Inventory API - INFO - The entry Accept in the header is as following: application/json
2022-08-16 10:48:14,673 - urllib3.connectionpool - DEBUG - Starting new HTTP connection (1): cumulocity:8111
2022-08-16 10:48:14,716 - urllib3.connectionpool - DEBUG - http://cumulocity:8111 "GET /identity/externalIds/c8y_Serial/67fzktfb75de6ud6n6edd6586f HTTP/1.1" 403 160
2022-08-16 10:48:14,717 - Inventory API - INFO - Response from request: {"error":"security/Forbidden","message":"Access is denied","info":"https://www.cumulocity.com/guides/reference-guide/#a-name-error-reporting-a-error-reporting"}
2022-08-16 10:48:14,717 - Inventory API - INFO - Response from request with code : 403
2022-08-16 10:48:14,717 - Inventory API - WARNING - Response from request: {"error":"security/Forbidden","message":"Access is denied","info":"https://www.cumulocity.com/guides/reference-guide/#a-name-error-reporting-a-error-reporting"}
2022-08-16 10:48:14,717 - Inventory API - WARNING - Got response with status_code: 403
2022-08-16 10:48:14,717 - Inventory API - ERROR - The following error occured:
2022-08-16 10:48:14,718 - werkzeug - INFO - 10.244.146.0 - - [16/Aug/2022 10:48:14] "GET /test HTTP/1.1" 200 -
The SOMEBASE64ENCODEDTHING do match between the response of the application/currentApplication/subscriptions and the one used in the identity call.
EDIT: Just checked the received service_decoder with password via Postman and that works from external but not from within the container? Any header Iâm missing?