How can I base64 encode a client ID and client secret in the Application Registry?

Popat420
Tera Expert

Hi all,

 

I have setup an Application Registry record in ServiceNow along with Connection and Credential Alias. 

But for this specific integration it is required the client id and client secret are base64 encoded, so how can I do this please? Can this be done via the Oauth API script field option in the app registry record?

When I test with Postman I use the base64 encoded client id secret in the Authorisation header,

 

Screenshot 2023-11-14 at 16.57.51 copy.png

 

Thanks in advance. 

1 ACCEPTED SOLUTION

Jaspal Singh
Mega Patron
Mega Patron

Hi,

You can try something from thread to pass the client id and secret value. Also, check link once.

 

View solution in original post

14 REPLIES 14

@Popat420 

 

I understand, but that is possible with what Jaspal suggested.


Use something like this in a script. 

var base64Val = gs.base64Encode(clientId + ':' + clientSecret);

 

And use that in the Auth header.

 

How is the Rest call triggered? If it's in a script, you could do this directly, or in a flow (action), use a script step, and use this as output.


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

Thanks @Peter Bodelier Im not sure I understood Jaspals Suggestion. Could you explain please? Where do I use the above script and where can I define the auth header in ServiceNow?

Hi @Popat420,

 

That depends, how are you triggering your REST call?


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

Dr Atul G- LNG
Tera Patron
Tera Patron

I am inline with @Jaspal Singh  solution.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Hi @Dr Atul G- LNG can you please explain to me what solution Jaspal has provided because I think I am not understanding clearly. The forum he has linked talks about using credentials username and password instead of base64 encoded ?