Create User

import authefyWebClient from './path/to/@authefy/web-client';

/*
 username - authefy unique username
 password - authefy password 
 email(optional) - user email. If appplication requires email verification,
    it will automatically send email verification link which the user will then
    click and get verified.
 externalId(optional): If the application has different user storage and they want
    to use their own custom id, set this externalId.
*/

await authefyWebClient.user.create({
  username: 'soaman',
  password: 'pisobr',
  email: 'cu@wuc.hn',
  externalId: '61426833-966e-5d7b-a4d9-ac269a7ac579',
  details: {
     name: 'Kathryn Manning'
  }
});

// returns: User Object

User Object:

type User {
    id: string;
    externalId?: string;
    username: string;
    groups: string[];
    isEmailVerified: boolean;
    isVerified: boolean;
    details: Record<string, any>;
}

Last updated

Was this helpful?