Riskguard Nexus Sample App

A minimal end‑to‑end example that shows how a frontend calls a backend API, performs a dummy login, and evaluates risk with a generated device ID.

login → evaluate-risk
POST /login
{
  "userId": "alice",
  "deviceId": "uuid-v4..."
}

→ Backend calls evaluate-risk
→ Returns: risk_score, risk_level, factors
🏷️

Frontend → Backend

The browser hosts a simple login form. On submit, it sends userId and a persistent deviceId to the backend endpoint /login.

🔐

No Real Authentication

The demo performs a fake authentication that always succeeds. The goal is to focus on the risk evaluation flow.

🪪

Device ID Handling

The frontend generates a UUIDv4 device identifier if none exists and stores it in localStorage for reuse across sessions.

🧠

Risk Evaluation

The backend calls the Riskguard Nexus API with IP, User‑Agent, user and device signals, then returns the risk score and details to the client.

Example
{
  "auth": { "success": true, "userId": "alice" },
  "risk": {
    "risk_score": 23,
    "risk_level": "low",
    "factors": ["new_device", "vpn_detected"],
    "recommendation": "allow"
  }
}

risk_score

Numeric score (0–100) summarizing observed risk. Lower is safer.

risk_level

Categorical level such as low, medium, or high to simplify decisioning.

factors

Array of key reasons (e.g., new_device, ip_velocity) that contributed to the score.

recommendation

Suggested action like allow, challenge, or block. Use this to trigger MFA, step‑up, or denial.