Vitron-Front/app/auth.server.ts
2026-04-29 01:44:16 +03:30

22 lines
669 B
TypeScript

import { Authenticator } from "remix-auth";
import { FormStrategy } from "remix-auth-form";
import { sessionStorage } from "./sessions.server";
export const authenticator = new Authenticator(sessionStorage);
// login
authenticator.use(
new FormStrategy(async ({ form }) => {
const phoneNumber = form.get("phoneNumber") as string;
const access_token = form.get("access_token") as string;
const refresh_token = form.get("refresh_token") as string;
return {
phoneNumber: phoneNumber?.toString(),
access_token: access_token?.toString(),
refresh_token: refresh_token?.toString(),
loggedIn: true,
};
}),
"vitrown-login"
);