WorkOS PHP SDK

MultiFactorAuth
in package

Table of Contents

Properties

$client  : HttpClient

Methods

__construct()  : mixed
challengeFactor()  : AuthenticationChallenge
Challenge Factor
createUserAuthFactor()  : UserAuthenticationFactorEnrollResponse
Enroll an authentication factor
deleteFactor()  : void
Delete Factor
enrollFactor()  : AuthenticationFactorEnrolled
Enroll Factor
getFactor()  : AuthenticationFactor
Get Factor
listUserAuthFactors()  : PaginatedResponse<string|int, AuthenticationFactor>
List authentication factors
verifyChallenge()  : AuthenticationChallengeVerifyResponse
Verify Challenge

Properties

Methods

challengeFactor()

Challenge Factor

public challengeFactor(string $id[, string|null $smsTemplate = null ][, RequestOptions|null $options = null ]) : AuthenticationChallenge

Creates a Challenge for an Authentication Factor.

Parameters
$id : string

The unique ID of the Authentication Factor to be challenged.

$smsTemplate : string|null = null

A custom template for the SMS message. Use the {{code}} placeholder to include the verification code.

$options : RequestOptions|null = null
Tags
throws
WorkOSException
Return values
AuthenticationChallenge

createUserAuthFactor()

Enroll an authentication factor

public createUserAuthFactor(string $userlandUserId, string $type[, string|null $totpIssuer = null ][, string|null $totpUser = null ][, string|null $totpSecret = null ][, RequestOptions|null $options = null ]) : UserAuthenticationFactorEnrollResponse

Enrolls a user in a new authentication factor.

Parameters
$userlandUserId : string

The ID of the user.

$type : string

The type of the factor to enroll.

$totpIssuer : string|null = null

Your application or company name displayed in the user's authenticator app.

$totpUser : string|null = null

The user's account name displayed in their authenticator app.

$totpSecret : string|null = null

The Base32-encoded shared secret for TOTP factors. This can be provided when creating the auth factor, otherwise it will be generated. The algorithm used to derive TOTP codes is SHA-1, the code length is 6 digits, and the timestep is 30 seconds – the secret must be compatible with these parameters.

$options : RequestOptions|null = null
Tags
throws
WorkOSException
Return values
UserAuthenticationFactorEnrollResponse

deleteFactor()

Delete Factor

public deleteFactor(string $id[, RequestOptions|null $options = null ]) : void

Permanently deletes an Authentication Factor. It cannot be undone.

Parameters
$id : string

The unique ID of the Factor.

$options : RequestOptions|null = null
Tags
throws
WorkOSException

enrollFactor()

Enroll Factor

public enrollFactor(AuthenticationFactorsCreateRequestType $type[, string|null $phoneNumber = null ][, string|null $totpIssuer = null ][, string|null $totpUser = null ][, string|null $userId = null ][, RequestOptions|null $options = null ]) : AuthenticationFactorEnrolled

Enrolls an Authentication Factor to be used as an additional factor of authentication. The returned ID should be used to create an authentication Challenge.

Parameters
$type : AuthenticationFactorsCreateRequestType

The type of factor to enroll.

$phoneNumber : string|null = null

Required when type is 'sms'.

$totpIssuer : string|null = null

Required when type is 'totp'.

$totpUser : string|null = null

Required when type is 'totp'.

$userId : string|null = null

The ID of the user to associate the factor with.

$options : RequestOptions|null = null
Tags
throws
WorkOSException
Return values
AuthenticationFactorEnrolled

listUserAuthFactors()

List authentication factors

public listUserAuthFactors(string $userlandUserId[, string|null $before = null ][, string|null $after = null ][, int|null $limit = null ][, EventsOrder $order = EventsOrder::Desc ][, RequestOptions|null $options = null ]) : PaginatedResponse<string|int, AuthenticationFactor>

Lists the authentication factors for a user.

Parameters
$userlandUserId : string

The ID of the user.

$before : string|null = null

An object ID that defines your place in the list. When the ID is not present, you are at the end of the list.

$after : string|null = null

An object ID that defines your place in the list. When the ID is not present, you are at the end of the list.

$limit : int|null = null

Upper limit on the number of objects to return, between 1 and 100. Defaults to 10.

$order : EventsOrder = EventsOrder::Desc

Order the results by the creation time. Defaults to "desc".

$options : RequestOptions|null = null
Tags
throws
WorkOSException
Return values
PaginatedResponse<string|int, AuthenticationFactor>

        
On this page

Search results