usePrepareSsoUrl
usePrepareSsoUrl(
params):UseQueryResult<NoInfer<PrepareSsoReturnType>,Error>
Defined in: react/src/hook/usePrepareSsoUrl.ts:45
Hook that builds the SSO popup URL ahead of the user’s click.
Wraps `prepareSsoUrl()`
in a @tanstack/react-query!useQuery | `useQuery()`, so the URL is
resolved while the page is idle. Handing the result to useOpenSso() as
{ ssoUrl } lets the popup open in the same tick as the click, which is
what keeps popup blockers out of the flow.
Parameters
Section titled “Parameters”params
Section titled “params”PrepareSsoParamsType
SSO parameters for URL generation
Returns
Section titled “Returns”UseQueryResult<NoInfer<PrepareSsoReturnType>, Error>
The query wrapping the prepareSsoUrl() action, resolving to
{ ssoUrl }
Example
Section titled “Example”const { data } = usePrepareSsoUrl({ metadata });const { mutate: openSso } = useOpenSso();
<button disabled={!data} onClick={() => data && openSso({ ssoUrl: data.ssoUrl })}> Login</button>Remarks
Section titled “Remarks”The URL embeds a proof-of-possession valid for 10 minutes. Past that the SSO still opens and the user still logs in — only the anonymous-to-wallet identity link is lost. On a page that can sit open for a long time, refetch rather than holding one URL indefinitely.
- `prepareSsoUrl()` for the underlying action
- `useOpenSso()` for opening the prepared URL