on 03-17-2020 6:52 AM
Hello,
we want to use the cloud foundry platform api (http://v3-apidocs.cloudfoundry.org/version/3.81.0/index.html) to do some automation.
The API is OAuth2 protected. In order to authenticate, we would need to create an oauth client and use the credentials to get a token. We did not find any way to do that.
How can we access the api?
There is one way for testing we found, as according to the cloud foundry documentation you can get an oauth token with the CLI command "cf oauth-token". That is the only way we found to actually being able to call the api, but this is only ok for some quick testing, but for a live scenario we need a REST way to get a token.
Cloud Foundry documentation describes some way to create a client, but this does not work on SAP Cloud Foundry, as we don't have access to tools and infrastructure.
Thanks and regards,
Tobias
With the help of SAP:
The CF Cloud Controller API is currently not connected to XSUAA and thus it is not possible to obtain a token from there. Instead you have to directly call the CF UAA service and use a valid user (no service key) and the following parameters. You should then get a valid token with cloud_controller.read and cloud_controller.write scopes.
Endpoint
https://login.cf.eu20.hana.ondemand.com/oauth/token (BTP region dependent)
Basic Authentication
user: cf
password: (empty - no password)
Parameters:
username: <BTP user email>
password: <BTP user password>
client_id: cf
grant_type: password
response_type: token
An example CURL call:
curl -v -XPOST -H"Application/json" -u "cf:" --data "username=<BTP user email>&password=<myPassword>&client_id=cf&grant_type=password&response_type=token" https://login.cf.eu20.hana.ondemand.com/oauth/token
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Mike! Could you please inform me about the CF User and where I can locate it? From what I gather, it's distinct from the BTP Cockpit user email. Also, how can I obtain the CF client_id? I'm attempting to execute the CURL example call on CF CLI, but I'm encountering an unauthorized error. Thanks for your assistance!
User | Count |
---|---|
72 | |
8 | |
8 | |
6 | |
6 | |
6 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.