Re: How to execute multiple CF REST methods with an unique authentication


James Bayer
 

* access tokens have a short time to live, something usually measured in
minutes, and generally are not revokable by the issuer as endpoints do not
check in with the issuer when making decisions
* refresh tokens have a longer time to love, usually hours or days, and can
be used to get new access tokens. refresh tokens are revokable.

use base64 to decode the token and you'll see the attributes.

On Mon, Sep 7, 2015 at 11:40 PM, Juan Antonio BreƱa Moral <
bren(a)juanantonio.info> wrote:

Hi,

you had reason. I stored in the right way the token, and Now it is
possible to reuse a token for multiple operations.

Example:

it.only("Using An unique Login, it is possible to execute 3 REST
operations", function () {
this.timeout(2500);

CloudFoundry.setEndPoint(endPoint);

var token_endpoint = null;
var refresh_token = null;
var token_type = null;
var access_token = null;
return CloudFoundry.getInfo().then(function (result) {
token_endpoint = result.token_endpoint;
return CloudFoundry.login(token_endpoint, username, password);
}).then(function (result) {
token_type = result.token_type;
access_token = result.access_token;
return CloudFoundryApps.getApps(token_type, access_token);
}).then(function (result) {
return CloudFoundryApps.getApps(token_type, access_token);
}).then(function (result) {
return CloudFoundryApps.getApps(token_type, access_token);
}).then(function (result) {
expect(true).to.equal(true);
});
});

What is the usage of token_refresh?
How to check the pending time for current token?

Juan Antonio


--
Thank you,

James Bayer

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