Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Use Bearer token in Credential for REST Integration

Rashi Kulshresh
Giga Contributor

Hi , 

I am doing a REST Integration using flow designer. For Authentication, I am using bearer token, which needs to be send in Authorization header. But Instead of directly putting the token in Authorization header, I want to use Credential Alias. But I am not able to find suitable credential type to put Bearer token. I cant use Oauth type credential as I don't have client Id and Client Secret. I have direct generated token. 

I tried API key credential but in runtime its not picking the Authorization header automatically . And failing with error "Error: U,Detail: Unexpected token: U" . 

 

@Ankur Bawiskar @Chuck Tomasi @Brad Tilton Please help.

 

Thanks.

7 REPLIES 7

Ashish Nahar
Kilo Guru

There is a blog which explains how to use this using the scripted api way not the credential alias.

 

https://community.servicenow.com/community?id=community_blog&sys_id=894deee5dbd0dbc01dcaf3231f96197b

Niclas
Giga Guru

Hi Rashi,

 

I had the same question. This oneworked for me. find_real_file.png

 

Also worth to mention - in the Executions Log, the Value will be hidden, so seems to be secure to use:

find_real_file.png

 

aliqaiser
Tera Contributor

Thanks for your Bearer token . Today it heleped me in BMC Discovery REST API call via flow designer

Hi Niclas,

 

can you show the step clearly where to create a input variable called credential step. As I not found an option to create a input In rest step

VamshiKrishna2_0-1675067604516.png