View Source WorkOS.SSO (WorkOS SDK for Elixir v1.1.0)

Manage Single Sign-On (SSO) in WorkOS.

@see https://docs.workos.com/sso/overview

Summary

Functions

Generates an OAuth 2.0 authorization URL.

Gets a profile given an access token.

Gets an access token along with the user Profile.

Lists all connections.

Functions

Link to this function

delete_connection(client \\ WorkOS.client(), connection_id)

View Source
@spec delete_connection(WorkOS.Client.t(), String.t()) :: WorkOS.Client.response(nil)

Deletes a connection.

Link to this function

get_authorization_url(params)

View Source
@spec get_authorization_url(map()) :: {:ok, String.t()} | {:error, String.t()}

Generates an OAuth 2.0 authorization URL.

Parameter options:

  • :organization - The organization connection selector is used to initiate SSO for an Organization.
  • :connection - The connection connection selector is used to initiate SSO for a Connection.
  • :redirect_uri - A Redirect URI to return an authorized user to. (required)
  • :client_id - This value can be obtained from the SSO Configuration page in the WorkOS dashboard.
  • :provider - The provider connection selector is used to initiate SSO using an OAuth provider.
  • :state - An optional parameter that can be used to encode arbitrary information to help restore application state between redirects.
  • :login_hint - Can be used to pre-fill the username/email address field of the IdP sign-in page for the user, if you know their username ahead of time.
  • :domain_hint - Can be used to pre-fill the domain field when initiating authentication with Microsoft OAuth, or with a GoogleSAML connection type.
Link to this function

get_connection(client \\ WorkOS.client(), connection_id)

View Source

Gets a connection given an ID.

Link to this function

get_profile(client \\ WorkOS.client(), access_token)

View Source

Gets a profile given an access token.

Link to this function

get_profile_and_token(client \\ WorkOS.client(), code)

View Source

Gets an access token along with the user Profile.

Parameter options:

  • :code - The authorization value which was passed back as a query parameter in the callback to the Redirect URI. (required)
Link to this function

list_connections(opts \\ %{})

View Source
Link to this function

list_connections(client, opts)

View Source

Lists all connections.

Parameter options:

  • :connection_type - Filter Connections by their type.
  • :organization_id - Filter Connections by their associated organization.
  • :domain - Filter Connections by their associated domain.
  • :limit - Maximum number of records to return. Accepts values between 1 and 100. Default is 10.
  • :after - Pagination cursor to receive records after a provided event ID.
  • :before - An object ID that defines your place in the list. When the ID is not present, you are at the end of the list.
  • :order - Order the results by the creation time. Supported values are "asc" and "desc" for showing older and newer records first respectively.