create

abstract suspend fun create(request: IPasswordsCreateParameters): PasswordsCreateResponse

Creates a new user with an email address and password, and establishes a session. Calls the POST /sdk/v1/passwords endpoint.

Kotlin:

StytchConsumer.passwords.create(
PasswordsCreateParameters(
email = "user@example.com",
password = "secretpassword",
sessionDurationMinutes = 30,
)
)

iOS:

let params = PasswordsCreateParameters(
email: "user@example.com",
password: "secretpassword",
sessionDurationMinutes: 30
)
let response = try await StytchConsumer.passwords.create(params)

React Native:

StytchConsumer.passwords.create({
email: "user@example.com",
password: "secretpassword",
sessionDurationMinutes: 30,
})

Return

PasswordsCreateResponse containing the newly created user and their session.

Parameters

request
  • IPasswordsCreateParameters

  • email — The email address for the new user.

  • password — The password for the new user.

  • sessionDurationMinutes — Duration of the session to create, in minutes.

Throws

StytchError

if the email is already in use or the password does not meet strength requirements.

if the coroutine is cancelled.