-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathinitAuth.ts
More file actions
44 lines (42 loc) · 1.39 KB
/
initAuth.ts
File metadata and controls
44 lines (42 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import { init } from "next-firebase-auth";
import { firebaseConfig } from "./constants";
const initAuth = () => {
init({
authPageURL: "/login",
appPageURL: "/contests",
loginAPIEndpoint: "/api/login", // required
logoutAPIEndpoint: "/api/logout", // required
// firebaseAuthEmulatorHost: "localhost:9099",
// Required in most cases.
firebaseAdminInitConfig: {
credential: {
projectId: firebaseConfig.projectId,
clientEmail:
"firebase-adminsdk-am4ez@task-pdf-writer.iam.gserviceaccount.com",
// The private key must not be accesssible on the client side.
privateKey: process.env.FIREBASE_PRIVATE_KEY
? JSON.parse(process.env.FIREBASE_PRIVATE_KEY)
: "",
},
databaseURL: firebaseConfig.databaseURL,
},
firebaseClientInitConfig: firebaseConfig,
cookies: {
name: "ExampleApp", // required
// Keys are required unless you set `signed` to `false`.
// The keys cannot be accessible on the client side.
keys: [
process.env.COOKIE_SECRET_CURRENT,
process.env.COOKIE_SECRET_PREVIOUS,
],
httpOnly: true,
maxAge: 12 * 60 * 60 * 24 * 1000, // twelve days
overwrite: true,
path: "/",
sameSite: "strict",
secure: true, // set this to false in local (non-HTTPS) development
signed: true,
},
});
};
export default initAuth;