authenticate

abstract suspend fun authenticate(request: IB2BPasswordAuthenticateParameters): B2BPasswordAuthenticateResponse

Authenticates a member with their email address and password, establishing a member session. Calls the POST /sdk/v1/b2b/passwords/authenticate endpoint. Automatically includes the intermediate session token if one is present.

Kotlin:

StytchB2B.passwords.authenticate(
B2BPasswordAuthenticateParameters(
organizationId = "org-test-d5a3b680-e8a3-40c0-b815-ab79986666d0",
emailAddress = "user@example.com",
password = "secretpassword",
sessionDurationMinutes = 30,
)
)

iOS:

let params = B2BPasswordAuthenticateParameters(
organizationId: "org-test-d5a3b680-e8a3-40c0-b815-ab79986666d0",
emailAddress: "user@example.com",
password: "secretpassword",
sessionDurationMinutes: 30
)
let response = try await StytchB2B.passwords.authenticate(params)

React Native:

StytchB2B.passwords.authenticate({
organizationId: "org-test-d5a3b680-e8a3-40c0-b815-ab79986666d0",
emailAddress: "user@example.com",
password: "secretpassword",
sessionDurationMinutes: 30,
})

Return

B2BPasswordAuthenticateResponse containing the authenticated member session.

Parameters

request
  • IB2BPasswordAuthenticateParameters

  • organizationId — The ID of the organization the member belongs to.

  • emailAddress — The member's email address.

  • password — The member's password.

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

  • locale? — Locale for any follow-up communications.

Throws

StytchError

if the credentials are invalid.

if the coroutine is cancelled.