Protected by MagenTrust
    MAGEN
    MAGEN Docs

    SDKs & Libraries

    Client libraries for integrating MagenTrust verification into your applications.

    API Base URL: https://api.magentrust.ai

    Enterprise IdP correlation

    When embedding after SSO, pass sourceHint: "entra-sso" (or your IdP label) at init(). The value is surfaced downstream asmagen_source_hint so SIEM and analytics can correlate MagenTrust sessions with the IdP-authenticated user. See Entra IdP sidecar and SCIM 2.0 provisioning.

    JavaScript

    Universal JavaScript SDK for browser environments.

    React

    React hooks and provider for seamless integration.

    Vanilla JS

    CDN script for CMS, Webflow, or static sites.

    Direct API

    Use the API directly without any SDK.

    Server-Side

    Server-side verification for higher assurance.

    Node.js SDK

    Server-side token validation for Node.js.

    Python SDK

    Server-side token validation for Python.

    Go SDK

    Server-side token validation for Go.

    Ruby SDK

    Server-side token validation for Ruby.

    Installation

    npm install @magen/react

    Usage

    1import { MagenProvider, useMAGEN } from '@magen/react';
    2
    3// Wrap your app with the provider
    4function App() {
    5  return (
    6    <MagenProvider 
    7      siteId="your-site-id"
    8      apiKey="your-api-key"
    9    >
    10      <CheckoutForm />
    11    </MagenProvider>
    12  );
    13}
    14
    15// Use the hook in your components
    16function CheckoutForm() {
    17  const { verify, isVerifying, result } = useMAGEN();
    18
    19  const handleSubmit = async (e: FormEvent) => {
    20    e.preventDefault();
    21    
    22    const verification = await verify();
    23
    24    if (verification.verdict === 'verified') {
    25      // Proceed with order, attach session_id for attribution
    26      await processOrder({
    27        ...formData,
    28        magenSessionId: verification.session_id
    29      });
    30    } else {
    31      // Handle based on risk_band
    32      toast.error('Please try again.');
    33    }
    34  };
    35
    36  return (
    37    <form onSubmit={handleSubmit}>
    38      {/* Form fields */}
    39      <button type="submit" disabled={isVerifying}>
    40        {isVerifying ? 'Verifying...' : 'Complete Order'}
    41      </button>
    42    </form>
    43  );
    44}

    Response Reference

    The verification response provides context for decision-making and attribution:

    verified
    Session passed verification. Safe to proceed with action.
    review
    Uncertain—may require additional friction or manual review.
    unverified
    Could not verify. Consider blocking or adding friction.

    Risk Bands

    Use risk_band to determine the appropriate response:

    Risk BandRecommended Action
    lowAllow without friction
    mediumAllow with logging or soft friction
    highAdd friction, challenge, or block

    Attribution Best Practice

    Always attach the session_id to your form submissions, analytics events, and CRM records. This enables you to segment leads by verification status and measure human-only conversion rates.