Basic authentication

vaibhavshar2358
Tera Contributor

I am trying to implement basic authentication in one of my applications. I have stored the credentials in my instance as a record. The password I am not able to read password because it is encrypted.

2 ACCEPTED SOLUTIONS

AyushKumarM
Mega Guru

Hello, 

You can use this piece of code to retrieve the credentials.
var details = {};
var provider = new sn_cc.StandardCredentialsProvider();
var credential = provider.getCredentialByID(credentialsSysId);
details.userID = credential.getAttribute("user_name");
details.password = credential.getAttribute("password");

View solution in original post

mayankkumar
Tera Sage

Hi @vaibhavshar2358,
---------------------------------------------------------------------------
What is your exact Use Case, could you please elaborate more?

Thanks & Regards
Mayank

View solution in original post

3 REPLIES 3

AyushKumarM
Mega Guru

Hello, 

You can use this piece of code to retrieve the credentials.
var details = {};
var provider = new sn_cc.StandardCredentialsProvider();
var credential = provider.getCredentialByID(credentialsSysId);
details.userID = credential.getAttribute("user_name");
details.password = credential.getAttribute("password");

mayankkumar
Tera Sage

Hi @vaibhavshar2358,
---------------------------------------------------------------------------
What is your exact Use Case, could you please elaborate more?

Thanks & Regards
Mayank

Abhay Kumar1
Giga Sage

@vaibhavshar2358 Check this one if helps and you can retrieve password if field type password2:

https://www.servicenow.com/community/developer-forum/how-to-get-value-from-password-field/m-p/250778...