View Source WorkOS.SSO (WorkOS SDK for Elixir v0.1.3)

The SSO module provides convenience methods for working with the WorkOS SSO platform. You'll need a valid API key, a client ID, and to have created an SSO connection on your WorkOS dashboard.

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

Link to this section Summary

Functions

Generate an Oauth2 authorization URL where your users will authenticate using the configured SSO Identity Provider.

Fetch the profile details for the authenticated SSO user.

Link to this section Functions

Link to this function

create_connection(source, opts \\ [])

View Source

Create a Connection

parameters

Parameters

source (source) The Draft Connection token that's been provided to you by WorkOS.js

example

Example

WorkOS.SSO.create_connection('draft_conn_12345')

Link to this function

get_authorization_url(params, opts \\ [])

View Source

Generate an Oauth2 authorization URL where your users will authenticate using the configured SSO Identity Provider.

parameters

Parameters

  • params (map)
    • domain (string) The domain for the relevant SSO Connection configured on your WorkOS dashboard. One of provider or domain is required
    • provider (string) A provider name for an Identity Provider configured on your WorkOS dashboard. Only 'Google' is supported.
    • connection (string) Unique identifier for a WorkOS Connection
    • client_id (string) Client ID for a WorkOS Environment. This value can be found in the WorkOS dashboard.
    • redirect_uri (string) The URI where users are directed after completing the authentication step. Must match a configured redirect URI on your WorkOS dashboard.
    • state (string) An aribtrary state object that is preserved and available to the client in the response.

example

Example

WorkOS.SSO.get_authorization_url(%{ domain: "workos.com", redirect_uri: "https://workos.com" })

Link to this function

get_profile(code, opts \\ [])

View Source

Fetch the profile details for the authenticated SSO user.

parameters

Parameters

  • code (string) The authorization code provided in the callback URL

example

Example

WorkOS.SSO.get_profile("12345")