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.
POST /login
{
"userId": "alice",
"deviceId": "uuid-v4..."
}
→ Backend calls evaluate-risk
→ Returns: risk_score, risk_level, factors
This sample illustrates a common integration pattern.
The browser hosts a simple login form. On submit, it sends userId and a persistent
deviceId to the backend endpoint /login.
The demo performs a fake authentication that always succeeds. The goal is to focus on the risk evaluation flow.
The frontend generates a UUIDv4 device identifier if none exists and stores it in localStorage
for reuse across sessions.
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.
Enter a user ID and submit. We’ll show the raw response returned from the backend.
Below is a representative shape of the response returned by the backend after calling the risk API.
{
"auth": { "success": true, "userId": "alice" },
"risk": {
"risk_score": 23,
"risk_level": "low",
"factors": ["new_device", "vpn_detected"],
"recommendation": "allow"
}
}
risk_scoreNumeric score (0–100) summarizing observed risk. Lower is safer.
risk_levelCategorical level such as low, medium, or high to simplify decisioning.
factorsArray of key reasons (e.g., new_device, ip_velocity) that contributed to the
score.
recommendationSuggested action like allow, challenge, or block. Use this to trigger MFA, step‑up, or denial.