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.

How can I get login user userId and password

rock2freedom
Mega Contributor

Can anyone help me? I stuck over a situation where I need to get login user password and user id .I can able to get the user Id by using   the following code .But I cant able to get password of the login user. Servicenow does not display the user password in the sys_user table.If sys_user does not contain the user password so where actually the password remain store.Plz help me.

i am using   the following code

var userDetail=new GlideRecord('sys_user');

  userDetail.addQuery('sys_id',userId);

  userDetail.query();

  while(userDetail.next())

  {

  var userName=userDetail.user_name;

  var password=userDetail.user_password;

  }

Thanx

Soumen

4 REPLIES 4

paramveer
Mega Guru

You can never get password of a login user. Password always save in encrypted form in user table. No one can access the password. If you try with Glide Record then it will give you only encrypted value, which has no use for you.



For logged in user you can go to left nav -->user administration-->logged in users



find_real_file.png



~Paramveer Singh


~Senior Developer



Please mark Helpful, Like, or Correct Answer if applicable.


Ashutosh Munot1
Kilo Patron
Kilo Patron

Its encrypted so you cant have access to password.


Ian Kirby1
Giga Expert

You won't be able to get the password for the user. It's stored in sys_user but, I believe, is a one-way encrypted string. In other words, when a user logs on and verifies the password internally, the password entered is re-encrypted and compared against the encrypted password string. If they match, it's the same password. However, there's no way to get the plain text version of the password within the system.



You shouldn' t ever require the user password. If the user password needs resetting, then type over the password field and save the record (also ticking the change password on login). If the requirement is an integration, set up a common source of authentication such as LDAP. If you need to have an integration log in to the ServiceNow instance, use the Basic authentication token over a user/password string. This is an encoded string that you can get through the REST web services explorer.


hi , I am looking for user name and password for servicenow for integration connection webhook from Docusign.  As i don't have userid and password how to do that basic authentication?