Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

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

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

Not applicable

@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.

Thanks @Community Alums 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?

Not applicable

Hi @Popat420,

 

That depends, how are you triggering your REST call?

Dr Atul - LNG
Tera Patron

I am inline with @Jaspal Singh  solution.

****************************************************************************************
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
******************************************************************************************

Hi @Dr Atul - 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 ?