cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Netpoint API

Former Member
0 Likes
285

I have problem setting the password for a new NPUser using the Netpoint API

I am able to create the UserId in the Users table but cannot find the way to set the password properly.

The password needs to be encrypted and I cannot find documentation on how to accomplish that.

My code is

netpoint.api.NPConnection cnn = new netpoint.api.NPConnection("server= x.x.x.x.;uid=netpoint;pwd=xxxx;database=NetPointDB_Test");

netpoint.api.account.NPUser user = new netpoint.api.account.NPUser("user", cnn, "praxis");

//netpoint.api.account.NPUser user = new netpoint.api.account.NPUser(cnn, "user");

user.AccountID = "001213";

user.UserID = "user1";

user.FirstName = "Marc";

user.LastName = "My Name";

user.Password = "1234";

//user.Password = netpoint.api.security.RMEncryption.EncryptString ("1234", "praxis");

user.Email = "mtrudel@implanciel.com";

user.ActiveFlag = true;

user.EncryptionKey = "praxis";

user.Save(true);

The password encryption is not done properly and result in an error message when login to Netpoint with the new user.

When checking the user table I can see that the password was NOT encrypted the same way as the other records

The privatekey in file “web.config” is “praxis”

The SDK included in the 5.9.6 package is 5.6.3.

So I am using SDK 5.6.3 with Netpoint 5.9.6 with database 5.9.2

Can you help please or send me practical example on how to use the encryption in Netpoint ?

Thank you

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Likes

so just to clarify use the same netpoint.api library as your web app (you can use the one in the bin dir) The code below is correct with "praxis" being the privatekey


netpoint.api.NPConnection cnn = new netpoint.api.NPConnection("server= x.x.x.x.;uid=netpoint;pwd=xxxx;database=NetPointDB_Test");

netpoint.api.account.NPUser user = new netpoint.api.account.NPUser("user", cnn, "praxis");

user.AccountID = "001213";
user.UserID = "user1";
user.FirstName = "Marc";
user.LastName = "My Name";
user.Password = "1234";
user.Email = "mtrudel@implanciel.com";
user.ActiveFlag = true;
user.Save(true);

a few things to troubleshoot

make sure the private key is in fact correct and wasn't changed

make sure if this was an upgrade that you ran the encryption updater

make sure config settings on the database (from the installer or webconfig table) are set to RM Encryption (this should be the only option in 5.96

Former Member
0 Likes

Your code should work. Password encryption is handled transparently by the NPUser class.

The encryption algorithym did change, though I am not sure exactly which version.

I would suggest referencing the same netpoint.api that is being used by your website.