refactor: identity -> iam
This commit is contained in:
16
modules/iam/routes/login/code/handle.ts
Normal file
16
modules/iam/routes/login/code/handle.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { NotFoundError } from "@platform/relay";
|
||||
|
||||
import { auth } from "../../../services/auth.ts";
|
||||
import { logger } from "../../../services/logger.ts";
|
||||
import route from "./spec.ts";
|
||||
|
||||
export default route.access("public").handle(async ({ body: { email, otp } }) => {
|
||||
const response = await auth.api.signInEmailOTP({ body: { email, otp }, asResponse: true, returnHeaders: true });
|
||||
if (response.status !== 200) {
|
||||
logger.error("OTP Signin Failed", await response.json());
|
||||
return new NotFoundError();
|
||||
}
|
||||
return new Response(null, {
|
||||
headers: response.headers,
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user