If I successfully logged in to cloud foundry with cf login
I can get a valid token with cf oauth-token
.
How can I get a valid token with a curl call or post request with username and password?
Thank you and best regards. Menu
You can use the following snippet:
cf_user=youremail@example.com
cf_password=yourpassword
curl -X POST 'https://login.lyra-836.appcloud.swisscom.com/oauth/token' \
-d "grant_type=password&scope=&username=${cf_user}&password=${cf_password}" \
--user cf:
Hint: You can inspect the HTTP requests of a CLI command by setting CF_TRACE=true
, i.e. CF_TRACE=1 cf login
.