Skip to main content
Docs

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:

function startSSOFlow(startSSOFlowParams: StartSSOFlowParams): Promise<StartSSOFlowReturnType>

Parameters

startSSOFlow() accepts the following parameters (StartSSOFlowParams):

  • Name
    strategy
    Type
    OAuthStrategy | EnterpriseSSOStrategy
    Description

    The strategy to use for authentication. The following strategies are supported:

  • 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.

  • Name
    signIn?
    Type
    SignIn | undefined
    Description

    The SignIn object that was created, which holds the state of the current sign-in and provides helper methods to navigate and complete the sign-in process.

  • Name
    signUp?
    Type
    SignUp | undefined
    Description

    The SignUp object that was created, which holds the state of the current sign-up and provides helper methods to navigate and complete the sign-up process.

How to use the useSSO() hook

For detailed examples of how to use the useSSO() hook, see the following guides:

Feedback

What did you think of this content?

Last updated on