Member Junction
    Preparing search index...

    Magic-link service. One instance per server, constructed with the resolved public URL and the validated config. Implements IServerExtensionMagicLinkService so BaseServerExtension implementations can mint, revoke, extend, and verify invites via context.services.GetMagicLinkService?.().

    Implements

    Index

    Constructors

    Methods

    • Redeems a raw token: validates the invite, atomically consumes one use, provisions/links the user with the restricted role + app, and mints a session JWT. Runs in the public (pre-auth) path, so it uses the global provider and a configured provisioning context user.

      Single-use is enforced by the guarded UPDATE inside the spConsumeMagicLinkInvite procedure (consumeInvite) BEFORE the token is minted — two concurrent redemptions of a single-use link race on the same row and exactly one wins. The consume is the gate: if a later step fails, the use is already burned (fail-closed). That is the correct trade-off for a single-use credential — burning a token on a server error is recoverable (re-issue); allowing replay is not.

      Parameters

      • rawToken: string
      • Optionalaudit: RedeemAuditContext

      Returns Promise<RedeemMagicLinkResult>

    • Verifies a signed redirect binding (rt) against the raw invite token's hash AND the host's allowed frontend origins. Returns the verified redirect URL, or undefined if absent/invalid.

      Parameters

      • rawToken: string
      • redirectBindingToken: string

      Returns string