Aller au contenu

openSso

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

openSso(client, inputArgs): Promise<OpenSsoReturnType>

Defined in: actions/openSso.ts:68

Function used to open the SSO

FrakClient

The current Frak Client

OpenSsoParamsType

Promise<OpenSsoReturnType>

Two SSO flow modes:

Redirect Mode (openInSameWindow: true):

  • Wallet generates URL and triggers redirect
  • Used when redirectUrl is provided

Popup Mode (openInSameWindow: false/omitted):

  • SDK generates URL client-side (or uses provided ssoPopupUrl)
  • Opens popup synchronously (prevents popup blockers)
  • Waits for SSO completion via postMessage

First we build the sso metadata

// Build the metadata
const metadata: SsoMetadata = {
logoUrl: "https://my-app.com/logo.png",
homepageLink: "https://my-app.com",
};

Then, either use it with direct exit (and so user is directly redirected to your website), or a custom redirect URL

Popup (default)
// Opens in popup, SDK generates URL automatically
await openSso(frakConfig, {
directExit: true,
metadata,
});
Redirect
// Opens in same window with redirect
await openSso(frakConfig, {
redirectUrl: "https://my-app.com/frak-sso",
metadata,
openInSameWindow: true,
});
Custom popup URL
// Advanced: provide custom SSO URL
const { ssoUrl } = await prepareSso(frakConfig, { metadata });
await openSso(frakConfig, {
metadata,
ssoPopupUrl: `${ssoUrl}&custom=param`,
});