Zitadel PHP API

Create
in package

At the end, you get a token, which is required for further updates of this session.

First, you have to set a user identifier. This can either be the user id or the login name. Then, you can define checks e.g. the Password or TOTP-Codes. If one check fails, the session won't be created. You can also define challenges e.g. an Email-OTP or SMS-OTP. Then, the Zitadel-API will send back the code.

Table of Contents

Properties

$emailCode  : string
$request  : array<string|int, mixed>
$sessionId  : string
$sessionToken  : string
$settings  : array<string|int, mixed>
$smsCode  : string

Methods

__construct()  : mixed
Initialize the Session create setup
create()  : void
Creates the session
getEmailCode()  : string
Returns the Email-OTP-Code. Works only, if you used the function returnEmailCode() before.
getSessionId()  : string
Returns the session id.
getSessionToken()  : string
Returns the session token
getSmsCode()  : string
Returns the SMS-OTP-Code. Works only, if you used the function returnSmsCode() before.
returnEmailCode()  : void
Set the challenge "Email-OTP".
returnSmsCode()  : void
Set the challenge "SMS-OTP".
setIdpIntentId()  : void
Set the check "External Identity Providers". You also have to set the IDP-Intent-Token.
setIdpIntentToken()  : void
Set the check "External Identity Providers". You also have to set the IDP-Intent-ID.
setLifetime()  : void
Set the session lifetime
setLoginName()  : void
Set the user identifier "login name". You can't set both user identifiers. This will result in an error.
setOtpEmail()  : void
Set the check "Email-OTP".
setPassword()  : void
Set the check "password".
setSmsCode()  : void
Set the check "SMS-OTP".
setTOTPCode()  : void
Set the check "TOTP-Code".
setUserId()  : void
Set the user identifier "id". You can't set both user identifiers. This will result in an error.

Properties

$emailCode

private string $emailCode

$request

private array<string|int, mixed> $request

$sessionId

private string $sessionId

$sessionToken

private string $sessionToken

$settings

private array<string|int, mixed> $settings

$smsCode

private string $smsCode

Methods

__construct()

Initialize the Session create setup

public __construct(mixed $settings) : mixed
Parameters
$settings : mixed

array The settings array

create()

Creates the session

public create() : void
Tags
throws
Exception

Returns an error, if the communication with Zitadel fails or one of the checks fails.

getEmailCode()

Returns the Email-OTP-Code. Works only, if you used the function returnEmailCode() before.

public getEmailCode() : string
Return values
string

The Email-OTP-Code

getSessionId()

Returns the session id.

public getSessionId() : string
Return values
string

The session id

getSessionToken()

Returns the session token

public getSessionToken() : string
Return values
string

The session token

getSmsCode()

Returns the SMS-OTP-Code. Works only, if you used the function returnSmsCode() before.

public getSmsCode() : string
Return values
string

The SMS-OTP-Code

returnEmailCode()

Set the challenge "Email-OTP".

public returnEmailCode() : void

returnSmsCode()

Set the challenge "SMS-OTP".

public returnSmsCode() : void

setIdpIntentId()

Set the check "External Identity Providers". You also have to set the IDP-Intent-Token.

public setIdpIntentId(string $idpIntentId) : void

You get the required value from the IDP-class.

Parameters
$idpIntentId : string

The IDP-Intent-ID

setIdpIntentToken()

Set the check "External Identity Providers". You also have to set the IDP-Intent-ID.

public setIdpIntentToken(string $idpIntentToken) : void

You get the required value from the IDP-class.

Parameters
$idpIntentToken : string

The IDP-Intent-Token

setLifetime()

Set the session lifetime

public setLifetime(int $seconds) : void
Parameters
$seconds : int

Duration in Seconds after which the session will be automatically invalidated

setLoginName()

Set the user identifier "login name". You can't set both user identifiers. This will result in an error.

public setLoginName(string $loginName) : void
Parameters
$loginName : string

The login name e.g. doe@your-zitadel-instance.com

setOtpEmail()

Set the check "Email-OTP".

public setOtpEmail(string $otpEmail) : void
Parameters
$otpEmail : string

The Email-Code

setPassword()

Set the check "password".

public setPassword(string $password) : void
Parameters
$password : string

The user password

setSmsCode()

Set the check "SMS-OTP".

public setSmsCode(string $smsCode) : void
Parameters
$smsCode : string

The SMS-Code

setTOTPCode()

Set the check "TOTP-Code".

public setTOTPCode(string $totpCode) : void
Parameters
$totpCode : string

The TOTP-Code

setUserId()

Set the user identifier "id". You can't set both user identifiers. This will result in an error.

public setUserId(string $userid) : void
Parameters
$userid : string

User Id


        
On this page

Search results