Java Microservice on Cumulocity 10.17
I’m trying to make my java microservice dynamic and supports multi-tenancy, and therefore would like to get all tenants subscribed to the application and their service username/passwords.
In order to do that, I’m using for authentication the bootstrap username and password provided by the Autowired Environment. I’m doing a GET call to the endpoint: /application/currentApplication/subscriptions.
For that I’m also using the baseurl provided by the environment for the domain, for the request to look like this: GET http://cumulocity:8111/application/currentApplication/subscriptions HTTP/1.1.
I made sure that the username and password are the bootstrap correct credentials, and made sure when making the call from postman using the real tenant domain, I would get the needed response. But when hosting the microservice, when the http request is executed, I get back the 401 error: “error”:“security/Unauthorized”,“message”:“Invalid credentials!”. I tried doing the authentication using the credentials provider, and using the base64 header, but both ways returned the same error.
Could someone help me with what am I doing wrong here?