cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Use values from Credential store

ashafqat2
Visitor

I have stored a token in credentail store. The credentail store ID is CREDENTIALS_VAULT-6166A12B9558E871 and credentail name is accesskey. How can I access this value in a variable. I tried below but I see NaN as a value

request.addHeader("Content-Type", "application/json");
request.addHeader("Authorization", "Bearer " + api.getValue("bearerToken"));
var access_key = api.getCredential("CREDENTIALS_VAULT-6166A12B9558E871", "token");
api.setValue("key", access_key);
request.addHeader("Key", + api.getValue("key"));

1 REPLY 1

dannemca
DynaMight Guru
DynaMight Guru

Hi @ashafqat2 , good day.

Try this instead:

var access_key = api.getCredential("CREDENTIALS_VAULT-6166A12B9558E871", "token");
api.setValue("key", access_key);
request.addHeader("Key",api.getValue("key"));

The '+' is crashing your token value.

Regards

Site Reliability Engineer @ Kyndryl

Featured Posts