Re: how to get cf authentication token programmatically


Noburou TANIGUCHI
 

Hi zooba,

Though I haven't tried them by myself, I conceived the following 2 methods:

(a) Push your app with an auth token and a refresh token, and refresh the
auth token using the refresh token

or,

(b) Create another user only for your app and push the app with the
credentials of the user


For (a), I'm not sure how an auth token is refreshed, but it seems able to
be done via /oauth/token endpoint in UAA [1].

For (b), it seems that you need just revokable credentials, so I think you
can use a user dedicated to the app as revokable credentials.


[1]
https://github.com/cloudfoundry/uaa/blob/master/docs/UAA-APIs.rst#oauth2-token-endpoint-post-oauth-token


I hope this helps.


zooba Sir wrote
Actually my app needs to get info of other apps running in same cf api
domain. To get this info, I'm calling APIs of other apps using
HTTP.GETrequest with authentication token in request header. And to get
this authentication token, I'm using HTTP:POST request to
'AuthorizationURL/oauth/token' with username and password in the request
header.
1.CF environment variables doesn't have all the info needed and so I'm
calling app's API directly and getting needed info from the returned JSON.
2. There is a config.json file in my local system in "C:\Users\MyUser\.cf"
path and has cf target api and auth token, but it gets populated only when
I'm logged into cf in command line. My app once deployed and running in
cf, should get the info of other apps even if I'm not logged in. So
getting auth token from local system's config.json is not a good idea.

Please suggest me another way to get auth token.




-----
I'm not a ...
noburou taniguchi
--
View this message in context: http://cf-dev.70369.x6.nabble.com/cf-dev-how-to-get-cf-authentication-token-programmatically-tp2668p2716.html
Sent from the CF Dev mailing list archive at Nabble.com.

Join cf-dev@lists.cloudfoundry.org to automatically receive all group messages.