forked from gladly-team/next-firebase-auth
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implement cookies.unified option to use unified cookie
a single unified cookie is required in order to make server side authentication work in firebase hosting scenarions. since firebase hosting only allows you to use on single cookie; cookies.signed will default to false when cookies.unified is set to true - related to github.com/gladly-team/issues/190
- Loading branch information
1 parent
0f357eb
commit 2c65bab
Showing
4 changed files
with
57 additions
and
38 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
import { getConfig } from 'src/config' | ||
|
||
const getBaseCookieName = () => getConfig().cookies.name | ||
const isCookieUnified = () => getConfig().cookies.unified | ||
|
||
export const getAuthUserCookieName = () => { | ||
const baseAuthCookieName = getBaseCookieName() | ||
if (isCookieUnified()) return baseAuthCookieName | ||
return `${baseAuthCookieName}.AuthUser` | ||
} | ||
|
||
export const getAuthUserTokensCookieName = () => { | ||
const baseAuthCookieName = getBaseCookieName() | ||
if (isCookieUnified()) return baseAuthCookieName | ||
return `${baseAuthCookieName}.AuthUserTokens` | ||
} |
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