Implemented a simple authentication scheme with Firebase and Iron Session
This commit is contained in:
18
src/lib/session.ts
Normal file
18
src/lib/session.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
// this file is a wrapper with defaults to be used in both API routes and `getServerSideProps` functions
|
||||
import type {IronSessionOptions} from "iron-session";
|
||||
import {User} from "@/interfaces/user";
|
||||
|
||||
export const sessionOptions: IronSessionOptions = {
|
||||
password: process.env.SECRET_COOKIE_PASSWORD as string,
|
||||
cookieName: "eCrop/ielts",
|
||||
cookieOptions: {
|
||||
secure: process.env.NODE_ENV === "production",
|
||||
},
|
||||
};
|
||||
|
||||
// This is where we specify the typings of req.session.*
|
||||
declare module "iron-session" {
|
||||
interface IronSessionData {
|
||||
user?: User | null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user