Create USER_MASTER - Issues with password

Create USER_MASTER - Issues with password


My eSpace pulls out users from the EnterpriseManager (USER_MASTER entity). However I would like grant the user the possiblity to add and maintain users and logins from  the eSpace. My script does the following: 
- Create USER_MASTER. Use Encrypt function to encrypt the given password
- Create USER entity. Copy relevant values from USER_MASTER. Fill 'External_Id' with the USER_MASTER Entity reference.

eSpace's User Provider is configured to 'EnterpriseManager'

I've confirmed that both entity records were created and that there is 1-to-1 relationship in between. 

This setup however does not work. New user receives 'invalid login' message after attempt to login. User is able to login if i change is password in the EM. My guess is something with the password setup.

What am missing?

Appericiate your help,