useSSO()
The useSSO()
hook is used to create a new SSO flow. It can be used in both web and native apps.
Returns
The useSSO()
hook returns the startSSOFlow()
method, which you can use to initiate the SSO flow.
startSSOFlow()
startSSOFlow()
has the following function signature:
Parameters
startSSOFlow()
accepts the following parameters (StartSSOFlowParams
):
- Name
strategy
- Type
OAuthStrategy
|EnterpriseSSOStrategy
- Description
The strategy to use for authentication. The following strategies are supported:
'oauth_<provider>'
: The user will be authenticated with their social connection account. See a list of supported values for<provider>
.'enterprise_sso'
: The user will be authenticated either through SAML, EASIE, or OIDC depending on the configuration of their enterprise SSO account.
- Name
identifier?
- Type
- string
- Description
Required if
strategy
is set to'enterprise_sso'
. The identifier of the user.
- Name
unsafeMetadata?
- Type
SignUpUnsafeMetadata
- Description
Metadata that can be read and set from the frontend and the backend. Once the authentication process is complete, the value of this field will be automatically copied to the created user's unsafe metadata (
User.unsafeMetadata
). One common use case is to collect custom information about the user during the authentication process and store it in this property. Read more about unsafe metadata.
Returns
startSSOFlow()
returns the following:
- Name
createdSessionId
- Type
string | null
- Description
The ID of the session that was created.
- Name
authSessionResult?
- Type
WebBrowser.WebBrowserAuthSessionResult | undefined
- Description
The result of the web browser session. See the Expo WebBrowser documentation for more details.
- Name
setActive?
- Type
(params: SetActiveParams) => Promise<void>
- Description
A method used to set the active session and/or organization. Accepts a
SetActiveParams
object.
How to use the useSSO()
hook
For detailed examples of how to use the useSSO()
hook, see the following guides:
Feedback
Last updated on