WorkOS.SSO (WorkOS SDK for Elixir v3.0.1)

Copy Markdown View Source

Operations for the SSO API.

Summary

Functions

authorize_logout(client, params \\ %{}, opts \\ [])

@spec authorize_logout(WorkOS.Client.t(), map(), keyword()) ::
  {:ok, WorkOS.SSOLogoutAuthorizeResponse.t()} | {:error, WorkOS.Error.error()}

Logout Authorize

You should call this endpoint from your server to generate a logout token which is required for the Logout Redirect endpoint.

Parameters

delete_connection(client, id, opts \\ [])

@spec delete_connection(WorkOS.Client.t(), String.t(), keyword()) ::
  {:ok, term()} | {:error, WorkOS.Error.error()}

Delete a Connection

Permanently deletes an existing connection. It cannot be undone.

Parameters

get_authorization_url(client, params \\ %{})

@spec get_authorization_url(WorkOS.Client.t(), map()) :: String.t()

Initiate SSO

Initiates the single sign-on flow.

Returns the fully-qualified redirect URL — no HTTP request is made.

Sets response_type ("code") automatically.

Reads client_id from the client configuration unless passed explicitly.

Parameters

  • params — query parameters: :provider_scopes, :provider_query_params, :domain (deprecated), :provider, :redirect_uri, :state, :connection, :organization, :domain_hint, :login_hint, :nonce, :prompt

get_connection(client, id, opts \\ [])

@spec get_connection(WorkOS.Client.t(), String.t(), keyword()) ::
  {:ok, WorkOS.Connection.t()} | {:error, WorkOS.Error.error()}

Get a Connection

Get the details of an existing connection.

Parameters

get_logout_url(client, params \\ %{})

@spec get_logout_url(WorkOS.Client.t(), map()) :: String.t()

Logout Redirect

Logout allows to sign out a user from your application by triggering the identity provider sign out flow. This GET endpoint should be a redirection, since the identity provider user will be identified in the browser session.

Before redirecting to this endpoint, you need to generate a short-lived logout token using the Logout Authorize endpoint.

Returns the fully-qualified redirect URL — no HTTP request is made.

Parameters

  • params — query parameters: :token

get_profile(client, opts \\ [])

@spec get_profile(
  WorkOS.Client.t(),
  keyword()
) :: {:ok, WorkOS.Profile.t()} | {:error, WorkOS.Error.error()}

Get a User Profile

Exchange an access token for a user's Profile. Because this profile is returned in the Get a Profile and Token endpoint your application usually does not need to call this endpoint. It is available for any authentication flows that require an additional endpoint to retrieve a user's profile.

Parameters

get_profile_and_token(client, params \\ %{}, opts \\ [])

@spec get_profile_and_token(WorkOS.Client.t(), map(), keyword()) ::
  {:ok, WorkOS.SSOTokenResponse.t()} | {:error, WorkOS.Error.error()}

Get a Profile and Token

Get an access token along with the user Profile using the code passed to your Redirect URI.

Sets grant_type ("authorization_code") automatically.

Reads client_id/client_secret from the client configuration unless passed explicitly.

Parameters

list_connections(client, params \\ %{}, opts \\ [])

@spec list_connections(WorkOS.Client.t(), map(), keyword()) ::
  {:ok, WorkOS.Page.t(WorkOS.Connection.t())} | {:error, WorkOS.Error.error()}

List Connections

Get a list of all of your existing connections matching the criteria specified.

Parameters

  • params — query parameters: :before, :after_, :limit, :order, :connection_type, :domain, :organization_id, :search
  • opts — per-request options (see WorkOS.Client.request/5)