Skip to content

Documentation / @frak-labs/react-sdk / usePrepareSso

Function: usePrepareSso()

usePrepareSso(params): UseQueryResult<PrepareSsoReturnType, Error>

Defined in: react/src/hook/usePrepareSso.ts:43

Hook that generates SSO URL for popup flow

This is a synchronous hook (no async calls) that generates the SSO URL client-side without communicating with the wallet iframe.

Parameters

params

PrepareSsoParamsType

SSO parameters for URL generation

Returns

UseQueryResult<PrepareSsoReturnType, Error>

Object containing:

  • ssoUrl: Generated SSO URL (or undefined if client not ready)
  • isReady: Boolean indicating if URL is available

Example

function MyComponent() {
  const { data } = usePrepareSso({
    metadata: { logoUrl: "..." },
    directExit: true
  });
 
  const handleClick = () => {
    if (ssoUrl) {
      window.open(data?.ssoUrl, "_blank");
    }
  };
 
  return <button onClick={handleClick} disabled={!isReady}>Login</button>;
}

See