For AI agents: the documentation index is at llms.txt. Guide pages have a markdown version at the same path with .md appended, before any query string or fragment.

Swift: Create a new user

Parameters

Examples

Sign up with email and password

let result = try await supabase.auth.signUp(
  email: "example@email.com",
  password: "example-password"
)

switch result {
case .signedIn(let session):
  print("Signed in as \(session.user.id)")
case .confirmationRequired(let user):
  print("Check your inbox, \(user.email ?? "")")
}

Sign up with a phone number and password (SMS)

let result = try await supabase.auth.signUp(
  phone: "123456789",
  password: "example-password",
  options: SignUpOptions(channel: .sms)
)

Sign up with a phone number and password (whatsapp)

let result = try await supabase.auth.signUp(
  phone: "123456789",
  password: "example-password",
  options: SignUpOptions(channel: .whatsapp)
)

Sign up with additional user metadata

let result = try await supabase.auth.signUp(
  email: "example@email.com",
  password: "example-password",
  options: SignUpOptions(
    userMetadata: [
      "first_name": .string("John"),
      "age": .number(24)
    ]
  )
)

Sign up with a redirect URL

let result = try await supabase.auth.signUp(
  email: "example@email.com",
  password: "example-password",
  options: SignUpOptions(
    redirectTo: URL(string: "https://example.com/welcome")!
  )
)