Environment
Spring Cloud Services
Purpose
- Access Spring Cloud Services instances with HTTP REST APIs (For example, eureka APIs).
- Use access token for troubleshooting purpose.
Note: The curl utility must be installed.
Procedure
1. Find service instance credentials by checking app's VCAP_SERVICES environment variables 'cf env APP_NAME'. Use config server instance as an example.
"credentials": { "access_token_uri": "https://p-spring-cloud-services.uaa.SYSTEM_DOMAIN/oauth/token", "client_id": "p-config-server-497b6620-b797-42b7-bbc0-3767faa0199d", "client_secret": "xxxxxxxx", "uri": "https://config-GUID.APP_DOMAIN" },
2. Obtain access token from Step1's access_token_uri, client_id, and client_secret and supply them as curl parameters, sample below:
$ curl -X POST 'https://p-spring-cloud-services.uaa.SYSTEM_DOMAIN/oauth/token' \ -d 'grant_type=client_credentials&client_id=p-config-server-497b6620-b797-42b7-bbc0-3767faa0199d&client_secret=gK1BXy8lSaQC' {"access_token":"xxxxxxx","token_type":"bearer","expires_in":29,"scope":"p-config-server.cbaa2ac4-3c17-4b16-8d51-ed28c3e11c2d.read","jti":"857a5653cb5a45159e5bad9953d61e64"
Additional Information
The token expires in 30 seconds, the new token is required once token expires.
Comments