Skip to content

Script Definition

javascript
function(context){     }
javascript
function(context){
var header =  {"Authorization":"Basic " + env.basicToken};
var body =  {"grant_type":"client_credentials"};
var result =  HttpClient.post(env.tokenUrl, body,  header);
context.access_token= JSON.parse(result).token;
}
Store the token from the interface in context.access_token
javascript
function(context){
var header =  {"Authorization":"Bearer " + context.access_token};
var result = HttpClient.get((env.userInfoUrl, null,  header);
new Log(context).debug(result);
[context.user.name](http://context.user.name/)=JSON.parse(result).user_name;
}
Retrieve the token stored in the previous step from context.access_token

BambooCloud IDaaS Open Platform