Module: WorkOS::PublicClient

Defined in:
lib/workos/public_client.rb

Class Method Summary collapse

Class Method Details

.create(client_id:, **opts) ⇒ WorkOS::Client

Construct a WorkOS::Client suitable for PKCE-only / public-client use. No api_key is required — methods that would normally send a Bearer Authorization header will skip it. Use PKCE flows on user_management and sso (‘get_authorization_url_with_pkce`, `authenticate_with_code_pkce`, etc.) instead of methods that require server-side credentials.

Parameters:

  • client_id (String)

    WorkOS client ID for the application.

  • opts (Hash)

    Additional options forwarded to Client.new (e.g. :base_url, :timeout, :max_retries, :logger, :log_level, :extra_headers).

Returns:

Raises:

  • (ArgumentError)


22
23
24
25
# File 'lib/workos/public_client.rb', line 22

def create(client_id:, **opts)
  raise ArgumentError, "client_id is required" if client_id.nil? || client_id.empty?
  WorkOS::Client.new(client_id: client_id, **opts)
end