SDKsGo SDKAuthentication
Register
Create user accounts programmatically with the Go SDK.
Register
Create user accounts server-side. Typically used for admin-initiated account creation, bulk import, or API-driven registration.
Register()
func (a *AuthService) Register(ctx context.Context, params *RegisterParams) (*Session, error)Parameters
| Field | Type | Required | Description |
|---|---|---|---|
Email | string | yes | Email address |
Password | string | yes | Password |
Traits | *UserTraits | no | Profile data |
OrganizationID | string | no | Add to organization |
Basic usage
session, err := client.Auth.Register(ctx, &avnologyid.RegisterParams{
Email: "[email protected]",
Password: "SecurePassword123!",
Traits: &avnologyid.UserTraits{
Name: &avnologyid.UserName{First: "Jane", Last: "Doe"},
Phone: "+15550100",
},
})
if err != nil {
var dup *errors.DuplicateAccountError
if errors.As(err, &dup) {
fmt.Println("Account already exists")
return
}
log.Fatal(err)
}
fmt.Println("Registered:", session.Identity.Email)VerifyEmail()
err := client.Auth.VerifyEmail(ctx, &avnologyid.VerifyEmailParams{
Code: "482901",
})See also
- Login -- Authenticate users
- Users admin -- Admin user creation