Hello team, I using descope nodejs sdk to create ...
# ask-a-descoper
a
Hello team, I using descope nodejs sdk to create users,
client.management.user.create(
loginId,
processedUserData
)
But user status in descope shows invited, is there any way to mark that user status Active by default without login?
Wanted to create users with Active status. Please suggest a way.
r
Hi @Arif When you use
create
, users are created without sending an invite and should have an Active status. If users show as "Invited", you're likely using the
invite
parameter or the wrong method. Use
createUser()
without the
invite
flag:
Copy code
const resp = await descopeClient.management.user.createUser(
  loginId,
  email,
  phone,
  displayName,
  roles,
  userTenants,
  customAttributes,
  picture,
  verifiedEmail,
  verifiedPhone,
  null,
  null,
  null,
  additionalLoginIds
);
The key difference:
Create
will not send an invite. If you want to send an invite on creation, use Invite User instead. To ensure Active status: • Don't set the
invite
parameter to
true
• Users created with
create
should be Active by default • Once a user successfully signs in, their status changes from Invited to Active If you need users to be Active immediately without login, use the
create
method (not
invite
), and they should appear as Active in the Descope Console. Check this doc: https://docs.descope.com/management/user-management https://docs.descope.com/management/user-management/sdks
a
@Rahul Rijhwani - • descopeClient.management.user.createUser - i dont see this method exist in SDK. • Also, there is no invite param in create method.
r
Hi @Arif Let me check with internal team and get back to you soon.
Hi @Arif You can use batch create you can pass status invite true / false https://docs.descope.com/api/management/users/batch-create-users But if you want to use the create only, You need to do second call to update status. https://docs.descope.com/api/management/users/update-user-status after create.
🙌 1
a
@Rahul Rijhwani - Update user status method is not available in nodejs SDK?
r
You can use curl api call