Member Junction
    Preparing search index...

    Client-side auth provider for MemberJunction-issued magic-link sessions.

    Unlike MSAL/Auth0, there is no interactive login and no SDK: the session token (minted server-side when the user redeemed their invite) arrives in the URL fragment — #token=<jwt> — when /magic-link/redeem redirects the browser to Explorer. This provider extracts it, stashes it in sessionStorage (per-tab, so it dies with the tab), decodes the claims for display, and hands the token to the GraphQL client via getIdToken(). The server validates it through the standard JWKS path.

    Set AUTH_TYPE: 'magic-link' in the Explorer environment to use this provider. There are no refresh tokens — when the session expires the user must redeem a fresh link.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    isAuthenticated$: BehaviorSubject<boolean> = ...
    type: "magic-link" = MJMagicLinkProvider.PROVIDER_TYPE

    Provider type identifier Must be implemented by concrete providers

    userEmail$: BehaviorSubject<string> = ...
    userInfo$: BehaviorSubject<StandardUserInfo | null> = ...
    PROVIDER_TYPE: "magic-link" = 'magic-link'

    Accessors

    • get preservedLocalStorageKeys(): Set<string>

      localStorage keys that survive a logout (e.g. UI theme preference).

      Override this getter in a subclass to preserve additional keys specific to your provider or application.

      Returns Set<string>

    Methods

    • Get profile picture URL from auth provider

      Returns the user's profile picture URL if available from the auth provider. This abstracts away provider-specific logic:

      • Microsoft/MSAL: Fetches from Graph API
      • Auth0/Okta: Returns from user claims

      Returns Promise<string | null>

      Promise resolving to image URL or null if not available

      const pictureUrl = await this.authBase.getProfilePictureUrl();
      if (pictureUrl) {
      this.userAvatar = pictureUrl;
      }
    • Handle session expiry when silent refresh fails

      Called internally when silent token refresh fails with TOKEN_EXPIRED or INTERACTION_REQUIRED errors. Providers that support refresh tokens can implement this as a no-op. Providers that require interactive re-authentication should initiate the appropriate flow (redirect, popup, etc.).

      Note: If this method redirects the page, it may never return. The app will reload after authentication completes and re-initialize with a fresh token.

      Returns Promise<void>

      Promise that resolves if re-auth completed, or never returns if redirected

    • Logout — clears all MJ client-side caches then delegates to the provider.

      Cache clearing happens universally regardless of auth provider so that a subsequent login as a different user never sees the previous user's data. Providers that need to clear additional caches should override logoutInternal() and call super.logoutInternal() if applicable.

      Returns Promise<void>

    • Refresh authentication token

      Attempts to obtain a fresh authentication token using the provider's refresh mechanism. If silent refresh fails due to session expiry, the provider will handle re-authentication automatically (which may involve redirecting to the auth provider's login page).

      Returns StandardAuthToken on success, or throws on complete failure.

      IMPORTANT: If the provider requires interactive re-authentication (redirect or popup), this method may never return. The app will reload after authentication completes and re-initialize with a fresh token.

      Returns Promise<StandardAuthToken>

      Promise resolving to StandardAuthToken or throws on failure

      const token = await this.authBase.refreshToken();
      return token.idToken; // Always succeeds or throws
    • True if a magic-link session token is present for this page load — either arriving in the URL fragment (#token=<jwt>, from the redeem redirect) or already stashed in sessionStorage from earlier in this tab.

      Used at module-config time (AuthServicesModule.forRoot) to auto-select the magic-link provider even when AUTH_TYPE names a different primary IdP, so a single Explorer deployment can serve both SSO users and magic-link guests. Falls back cleanly to the primary IdP when no token is present (e.g. after a guest's session expires or logs out).

      Returns boolean