Aller au contenu

usePrepareSso

Ce contenu n’est pas encore disponible dans votre langue.

usePrepareSso(params): UseQueryResult<PrepareSsoReturnType, Error>

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

Hook that asks the wallet for an SSO URL without opening the popup

It’s a @tanstack/react-query!home | `tanstack` wrapper around the `prepareSso()` action

PrepareSsoParamsType

SSO parameters for URL generation

UseQueryResult<PrepareSsoReturnType, Error>

The query hook wrapping the prepareSso() action, its data carrying the generated ssoUrl

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