Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Unable to reset operator password with api

roro_coeur
Level 3
Level 3

Hello,

I am trying to change an operator password with this JS code :

 

var resetPassword = NLWS.xtkOperator.ResetPassword("login123", "newpassword");

 

but I get Method 'ResetPassword' unknown in schema 'xtk:operator'.

 

Any clue why?

 

Thank you for your help,

1 Accepted Solution
roro_coeur
Correct answer by
Level 3
Level 3

Using the method HashPassword works : 

NLWS.xtkSession.HashPassword("new_password");

And use the value to update the password column in the operator table.

View solution in original post

7 Replies
Manoj_Kumar_
Community Advisor
Community Advisor

Hello @roro_coeur ,

 

It seems you are trying to run this code via a javascript activity in a workflow.

You don't have administrator access that is why the reset password function is not accessible by your login.

 

You can check the journal tab for more information. You will see an error which says "XTK-170020 Non authorized access to requested service (right 'admin' needed)."

 

Operators with admin access can run this code without any issues.

 

Thanks,

Manoj

roro_coeur
Level 3
Level 3
Hello Mano, I am running the workflow containing the js activity with an admin operator. And I don't get the "Non authorized access to requested service" message.
Manoj_Kumar_
Community Advisor
Community Advisor
Hello roro_coeur I have just tested this code with an operator with full admin rights and it worked without any issues. However when i tried the same code with another operator with limited access then i got the same error. I believe you don't have right to update the operators
Mukesh_Gattu_SA
Level 1
Level 1

Hi @roro_coeur ,

 

Are you using the loadLibrary to load the method implementation ? Seems like workflow could not reference the method implementation.

Please add below.

loadLibrary("namespace:xxx.js"); // replace the placeholder with the .js information.

roro_coeur
Level 3
Level 3
Hi Mukesh, which library should I load? I don't see any operator.js livrary?
roro_coeur
Correct answer by
Level 3
Level 3

Using the method HashPassword works : 

NLWS.xtkSession.HashPassword("new_password");

And use the value to update the password column in the operator table.