LoginRadius is a customer identity platform for hosted login, social login, registration, user profiles, and account-management flows. Its official loginradius-sdk wraps the LoginRadius V2 APIs for Node.js. In a DaloyJS API, use it as a server-side verifier for LoginRadius access tokens and as a profile API client.
LoginRadius access-token validation
Client appLoginRadiusDaloyJS API
01asyncClient appLoginRadiusHosted login, social login, or registration flowLoginRadius issues an access token
05responseDaloyJS APIClient app401 on invalid token, protected data on success
LoginRadius access tokens are validated through the provider API via the Node SDK. This is different from the JWT/JWKS provider pages, where verification is local after the signing keys are cached.
1. Configure LoginRadius
In the LoginRadius Admin Console, copy your API Key, API Secret, and Site Name.
Configure your hosted login, social login, registration, and callback URLs in LoginRadius. The frontend owns the login flow and sends the resulting access token to your DaloyJS API.
Keep the API secret on the server only. Never expose it in browser, mobile, or generated client code.
import { z } from "zod";import { App, secureHeaders, rateLimit } from "@daloyjs/core";import { loginRadiusPlugin } from "./plugins/loginradius";import { requireAuth } from "./plugins/auth"; // from the Overview pageconst app = new App();app.use(secureHeaders());app.use(rateLimit({ windowMs: 60_000, max: 100 }));app.register(loginRadiusPlugin);app.route({ method: "GET", path: "/me", operationId: "getMe", middleware: [requireAuth()], responses: { 200: { description: "OK", body: z.object({ userId: z.string(), email: z.string().optional(), }), }, }, handler: ({ state }) => ({ status: 200, body: { userId: state.principal!.sub, email: state.principal!.email, }, }),});
Role checks
LoginRadius profile shape depends on your account configuration and selected fields. If your site stores roles or authorization flags in the profile, normalize them in the plugin and enforce them with a narrow middleware:
ts
import type { Middleware } from "@daloyjs/core";export function requireLoginRadiusRole(role: string): Middleware { return async (ctx, next) => { if (!ctx.state.principal?.roles.includes(role)) { return ctx.problem(403, "forbidden", `Requires ${role}`); } return next(); };}
Registration and account APIs
The SDK also wraps registration, password reset, email verification, access-token invalidation, account lookup, and custom-object APIs. Keep those operations in server-side routes, validate every input with your schema library, and return DaloyJS problem+json errors instead of raw SDK error objects.
Runtimes
loginradius-sdk is a Node-style CommonJS SDK. Use it on the Node adapter, Bun when your deployment supports CommonJS packages, Vercel Node functions, and AWS Lambda. It is not a fit for Cloudflare Workers or Vercel Edge. For edge APIs, put LoginRadius validation behind a small Node service or use direct HTTP calls from a runtime that can safely keep server secrets.
Security notes
Treat the LoginRadius API secret like a signing key. Store it in your platform secret manager and never send it to clients.
Validate the access token on every protected API request, or cache positive validation results only for a short period bounded by token expiry.
Use rateLimit() on login, registration, password reset, and token-validation routes. Identity endpoints are high-value abuse targets.
Do not trust user profile fields as authorization policy until your backend has normalized them into explicit roles, scopes, or tenant memberships.