Hiding password from REST API script

AGK
Giga Contributor

I am using  javascript to insert an entry in ServiceNow table using REST API (System Web Service ) Method.

Is there any option that I can hide password from script?, I am good to use any other script language also.

My goal is to insert an entry in an ServiceNow table from outside ServiceNow like a windows server or UI page.

client.setRequestHeader('Authorization', 'Basic '+btoa('admin'+':'+'admin'));

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

may be you can try to get it from system property by storing it as password type in system property

create system property of type password and store that and use that in your script.

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Syvo
Mega Guru
Hi, I think you can use the encoded btoa value instead but that will just be a simple obfuscation. Don't use the admin user anyway. The best solution is to go password less with oauth or a client certificate.

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

Any update on this?
Can you mark my answer as correct, helpful if you were able to achieve the requirement. This helps in removing this question from unanswered list and helps users to learn from your thread. Thanks in advance.
 
Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader