Hi, I currently facing an issue with Descope user...
# ask-a-descoper
r
Hi, I currently facing an issue with Descope user authentication. We did migrated our users from our legacy system to Descope, including the user password using argon2 encryption. After migration, when user tried to login, Descope will just return an error:
Copy code
{
    errorCode: "E062901",
    errorDescription: "Invalid signin credentials",
  }
m
@Rahul Rijhwani can you help here ?
@RBTech can you share project id ?
r
@Meir Wahnon
P3332Fy6YtvcpFpykFB6tF8zXNAj
r
Hi @RBTech Let me check
@RBTech The error code E062901 ("Invalid signin credentials") means the credentials provided during sign-in are incorrect. Since you migrated user passwords using Argon2, can you verify below configs: 1. The Argon2 hash, salt, iteration, memory, and thread parameters in your import exactly match those used in your legacy system. 2. The hash and salt values are properly base64-encoded as required by Descope. 3. All required user fields (like loginId) are present and correct in Descope. Here is the expected Argon2 password import format:
Copy code
"hashedPassword": {
  "argon2": {
    "hash": "base64 string",
    "salt": "base64 string",
    "iterations": 8,
    "memory": 8192,
    "threads": 1
  }
},
If any parameter is incorrect or missing, authentication will fail. Double-check your migration data and try again. Docs: https://docs.descope.com/migrate/custom Commons error: https://docs.descope.com/common-errors
r
Thanks @Rahul Rijhwani. There are 2 ways to create users, batch create and single create - do both need base64 string for
hash
and
salt
?
r
Yes, both batch create and single create require the Argon2 hash and salt to be provided as base64-encoded strings. All Argon2 parameters—hash, salt, iterations, memory, and threads—must match your legacy system's values, and both methods use the same format for these fields
r
@Rahul Rijhwani I've made sure that
hash
and
salt
are base64 encoded. I did another migration test, users were successfully created in Descope but got the same error when I tried to login.
r
Let me check
r
@Rahul Rijhwani Let me know if you need more details
Here's a timeline of a user migration to Descope. The
Create Password
action was logged when I set the user password via management API, I think this means that during
UserCreated
action, password was not set.
Can you please confirm this?
LoginSucceeded
action logged after I set the user password via management API
@Rahul Rijhwani @Meir Wahnon Let me know if you have any updates on this. Thanks.
Is there a way to check if there is password set for a user?
I found it
GET /v1/mgmt/user
- migrated users has
password: false
- this that password is not set for users.
r
Let me check @RBTech
the audit timeline confirms that the password wasn't set during the initial
UserCreated
event. According to the audit events documentation, the
CreatePassword
event indicates "A password has been created for a user" Your timeline shows: •
UserCreated
- User created without password •
UserModified
- User details updated •
CreatePassword
- Password created via management API •
UserModified
- User updated again •
ChangePassword
- Password changed •
LoginFailed
- First login attempt failed •
LoginSucceed
- Login eventually succeeded This sequence suggests the password migration during user creation didn't work properly. The
Create
operation from the management SDK documentation shows it doesn't send an invite by default
Copy code
const resp = await descopeClient.management.user.create(
  loginId,
  {
      email,
      phone,
      displayName,
      // picture,
      verifiedEmail,
      verifiedPhone,
      customAttributes,
      additionalLoginIds,
      // userTenants,// either userTenants or roles
      roles,
  }
);
For proper password migration, you need to include the hashed password in the initial user creation request. The separate
CreatePassword
event indicates you had to set the password afterward using a management API call, which explains why the initial login failed with error E062901 "Invalid signin credentials" Refer docs : https://docs.descope.com/audit-trails-and-integrations/audit-events https://docs.descope.com/management/user-management/sdks https://docs.descope.com/common-errors
Since your migrated users show
password: false
, the Argon2 hashed passwords weren't properly included during user creation. This confirms that the password migration didn't work properly during the initial user creation. you'll need to either: 1. Re-migrate with the correct hashed password format included in the initial user creation 2. Use the management SDK to set passwords for existing users For setting passwords on existing users, you can use the setActivePassword method Check this doc: https://docs.descope.com/management/user-management/sdks#set-an-active-password-for-user
r
@Rahul Rijhwani I will check and if possible provide you the payload for the user creation. Yes, we will not send invite as we will migrate users in the background. These users are already active in our application.
r
Sure @RBTech