-
-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: introduced
enableMultipleCookies
auth middleware option to in…
…crease token capacity
- Loading branch information
1 parent
06ebded
commit 23ee02f
Showing
14 changed files
with
522 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,33 @@ | ||
export const serverConfig = { | ||
useSecureCookies: process.env.USE_SECURE_COOKIES === "true", | ||
useSecureCookies: process.env.USE_SECURE_COOKIES === 'true', | ||
firebaseApiKey: process.env.FIREBASE_API_KEY!, | ||
serviceAccount: process.env.FIREBASE_ADMIN_PRIVATE_KEY ? { | ||
projectId: process.env.FIREBASE_PROJECT_ID!, | ||
clientEmail: process.env.FIREBASE_ADMIN_CLIENT_EMAIL!, | ||
privateKey: process.env.FIREBASE_ADMIN_PRIVATE_KEY.replace(/\\n/g, "\n")!, | ||
} : undefined, | ||
serviceAccount: process.env.FIREBASE_ADMIN_PRIVATE_KEY | ||
? { | ||
projectId: process.env.FIREBASE_PROJECT_ID!, | ||
clientEmail: process.env.FIREBASE_ADMIN_CLIENT_EMAIL!, | ||
privateKey: process.env.FIREBASE_ADMIN_PRIVATE_KEY.replace( | ||
/\\n/g, | ||
'\n' | ||
)! | ||
} | ||
: undefined | ||
}; | ||
|
||
export const authConfig = { | ||
apiKey: serverConfig.firebaseApiKey, | ||
cookieName: "AuthToken", | ||
cookieName: 'AuthToken', | ||
cookieSignatureKeys: [ | ||
process.env.COOKIE_SECRET_CURRENT!, | ||
process.env.COOKIE_SECRET_PREVIOUS! | ||
], | ||
cookieSerializeOptions: { | ||
path: "/", | ||
path: '/', | ||
httpOnly: true, | ||
secure: serverConfig.useSecureCookies, // Set this to true on HTTPS environments | ||
sameSite: "lax" as const, | ||
maxAge: 12 * 60 * 60 * 24, // twelve days | ||
sameSite: 'lax' as const, | ||
maxAge: 12 * 60 * 60 * 24 // twelve days | ||
}, | ||
serviceAccount: serverConfig.serviceAccount, | ||
// Set to false in Firebase Hosting environment due to https://stackoverflow.com/questions/44929653/firebase-cloud-function-wont-store-cookie-named-other-than-session | ||
enableMultipleCookies: true | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.