{
"type": "object",
"properties": {
"email": {
"type": "string",
"format": "email",
"maxLength": 254
},
"password": {
"type": "string",
"minLength": 1,
"maxLength": 256
}
},
"required": [
"email",
"password"
]
}{error:{code,message}} for CloudError failures, attaches Request-Id, and disables caching. Handle 401 by signing in; show role refusal for 403 forbidden, reauthenticate only for step_up_required, and collect a reason for 400 reason_required. A CSRF failure needs a current page/session token, not blind retries. Operation-specific 404/409/413/422/502/503 errors retain their status. Honor Retry-After on 429./** POST /api/admin/auth/sign-in {email, password} → {done} with the session cookie, or {challenge, session, username, secret?, otpauth?}. */
export const POST = authRoute(async (request, { requestId }) => {
if (!staffConfigured()) throw new CloudError(503, "not_configured", "Staff sign-in isn't configured yet (ADMIN_USER_POOL_ID).");
const { email, password } = await readBody(request, signInSchema);
await limitLogin(request, email);
const step = await initiate(email, password).catch((error) => {
throw staffAuthFailure(error, "sign-in");
});
return stepResponse(step, request, requestId);
});