@schibsted/account-sdk-browser
    Preparing search index...

    Class Account

    Unified client-side interface for a configured Schibsted Account integration.

    Create an instance with createAccountSdk() unless you explicitly need to construct it yourself. The instance coordinates identity, login, session, and access-check features for one configured client.

    Index

    Methods

    • Builds the Schibsted Account profile page URL.

      Parameters

      • OptionalredirectUri: string

        Where the account page should redirect the browser afterwards.

      Returns string

    • Removes a cached access-check result.

      Parameters

      • productIds: string[]

        Product or feature ids used for the cached lookup.

      • userId: number

        User id used for the cached lookup.

      Returns void

    • Removes the cached Session Service user session response.

      Returns void

    • Returns an external identifier for the authenticated user, scoped to the configured client and external party.

      Parameters

      • externalParty: string

        External party for which the identifier is generated.

      • optionalSuffix: string = ''

        Optional suffix included when generating the identifier.

      Returns Promise<string>

      If the session lookup fails, the session does not contain a pairId, or externalParty is empty.

      Retained for compatibility with existing integrations. Avoid new usage.

    • Returns the Varnish sp_id value from the current session when present.

      Returns Promise<string | null>

    • Returns the realm-specific Schibsted Account user id as a number.

      Use getUserUuid() when you need the globally unique user id.

      Returns Promise<number>

      If the user is not connected to the configured client.

    • Returns the user SDRN from the current session.

      Returns Promise<string>

      If the SDRN is missing from the session response.

    • Returns the globally unique user id from the current session.

      Returns Promise<string>

      If the user is not connected to the configured client.

    • Checks whether the current user has access to any of the requested products or features.

      When productIds is omitted, the ids configured as defaultProductIds are used. Results are cached according to the TTL returned by Session Service.

      Parameters

      • productIds: string[] | undefined = ...

        Product or feature ids to check instead of the configured defaults.

      Returns Promise<HasAccessResult | null>

      Access data, or null when the user is not entitled.

      If product ids are not provided or configured, sessionDomain is missing, the current user cannot be resolved, input is invalid, or the request fails.

    • Queries Session Service and returns the current browser session state.

      This call may trigger a full-page session refresh redirect. Configure callbackBeforeRedirect if your app needs to persist state before that navigation.

      Returns Promise<SessionResponse>

      If the Session Service call fails.

    • Checks whether the current user is connected to the configured client.

      A user can be logged in to Schibsted Account without being connected to your client, for example before accepting required terms.

      Returns Promise<boolean>

    • Checks whether the browser currently has a Schibsted Account session.

      Returns false instead of throwing when the session lookup fails.

      Returns Promise<boolean>

    • Starts the login flow with either a full-page redirect or a popup.

      Call this from a user gesture when preferPopup is enabled, otherwise browser popup blockers may block the popup and the SDK will fall back to redirect navigation.

      Parameters

      Returns Window | null

      A popup window reference when a popup is opened; otherwise null.

    • Builds the login URL without navigating the browser.

      Parameters

      Returns string

    • Logs the user out from the brand Session Service session and redirects the browser.

      Parameters

      • OptionalredirectUri: string

        Where Session Service should redirect the browser after logout.

      Returns void

    • Builds the logout URL without navigating the browser.

      Parameters

      • OptionalredirectUri: string

        Where Session Service should redirect the browser after logout.

      Returns string

    • Enables or disables caching for subsequent session lookups.

      Changing this setting does not remove an existing cached session.

      Parameters

      • enabled: boolean

      Returns void