WorkOS PHP SDK

Widgets
in package

Table of Contents

Properties

$client  : HttpClient

Methods

__construct()  : mixed
createToken()  : WidgetSessionTokenResponse
Generate a widget token

Properties

Methods

createToken()

Generate a widget token

public createToken([string|null $organizationId = null ][, string|null $userId = null ][, array<string|int, WidgetSessionTokenScopes>|null $scopes = null ][, RequestOptions|null $options = null ]) : WidgetSessionTokenResponse

Generate a widget token for a user, optionally scoped to an organization. When an organization is specified, org-scoped widgets are enabled; omitting it issues a user-only token for widgets like UserProfile and UserSecurity.

Parameters
$organizationId : string|null = null

The ID of the organization to scope the widget session to. Required when scopes are provided. Optional when issuing a token for user-only widgets (e.g. UserProfile, UserSecurity) that do not require organization context.

$userId : string|null = null

The ID of the user to issue the widget session token for.

$scopes : array<string|int, WidgetSessionTokenScopes>|null = null

The scopes to grant the widget session.

$options : RequestOptions|null = null
Tags
throws
WorkOSException
Return values
WidgetSessionTokenResponse
On this page

Search results