how to add authorization token to header in rest message script

redth
Giga Expert

how to add authorization token to header in rest message script, I'm using the below one and its not working. Please assist.

a.setRequestHeader('authorization', 'Bearer'+token);

1 ACCEPTED SOLUTION

Tony Chatfield1
Kilo Patron

Hi, testing quickly in a PDI it looks like white space is needed after 'Bearer'
IE  a.setRequestHeader('authorization', 'Bearer '+token);

Otherwise, where does your token value come from? If retrieving from a password2 type encrypted field then you would need to decrypt the value before using. 

View solution in original post

1 REPLY 1

Tony Chatfield1
Kilo Patron

Hi, testing quickly in a PDI it looks like white space is needed after 'Bearer'
IE  a.setRequestHeader('authorization', 'Bearer '+token);

Otherwise, where does your token value come from? If retrieving from a password2 type encrypted field then you would need to decrypt the value before using.