openSso
openSso(
client,inputArgs):Promise<OpenSsoReturnType>
Defined in: actions/openSso.ts:71
Function used to open the SSO
Parameters
Section titled “Parameters”client
Section titled “client”The current Frak Client
inputArgs
Section titled “inputArgs”Returns
Section titled “Returns”Promise<OpenSsoReturnType>
Description
Section titled “Description”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 the popup, then waits for SSO completion via postMessage
Pass { ssoUrl } from
`prepareSsoUrl()` to open
the popup without awaiting anything first — see the popup-blocker note below.
Example
Section titled “Example”First we build the sso metadata
// Build the metadataconst 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
// Opens in popup, SDK generates URL automaticallyawait openSso(frakConfig, { directExit: true, metadata,});// Opens in same window with redirectawait openSso(frakConfig, { redirectUrl: "https://my-app.com/frak-sso", metadata, openInSameWindow: true,});// Prepared ahead of the click, so the popup opens synchronouslyconst { ssoUrl } = await prepareSsoUrl(frakConfig, { metadata });// ...later, directly in the click handler:await openSso(frakConfig, { ssoUrl });// Advanced: provide custom SSO URLconst { ssoUrl } = await prepareSso(frakConfig, { metadata });await openSso(frakConfig, { metadata, ssoPopupUrl: `${ssoUrl}&custom=param`,});