{title}
{date}
{' ・ '}
{author}
{code}
{description}
{children}
); } ================================================ FILE: docs/components/FooterSeparator.tsx ================================================ export default function FooterSeparator() { return ( · ); } ================================================ FILE: docs/components/Hero.tsx ================================================ import HeroCode from './HeroCode'; import LinkButton from './LinkButton'; import Wrapper from './Wrapper'; type Props = { description: string; getStarted: string; titleRegular: string; titleStrong: string; viewExample: string; }; export default function Hero({ description, getStarted, titleRegular, titleStrong, viewExample }: Props) { return ({description}
import
type
{' '}
{'{'} NextRequest {'}'}{' '}
from
"next/server"
;
{'\n'}
import
{' '}
{'{'} authMiddleware {'}'}{' '}
from
"next-firebase-auth-edge"
;
{'\n'}
{'\n'}
export
async
function
proxy
(request
:
NextRequest
) {'{'}
{'\n'}
{' '}
return
authMiddleware
(request
,
{'{'}
{'\n'}
{' '}loginPath
:
"/api/login"
,
{'\n'}
{' '}logoutPath
:
"/api/logout"
,
{'\n'}
{' '}apiKey
:
"XXxxXxXXXxXxxxxx_XxxxXxxxxxXxxxXXXxxXxX"
,
{'\n'}
{' '}cookieName
:
"AuthToken"
,
{'\n'}
{' '}cookieSignatureKeys
:
[
"Key-Should-Be-at-least-32-bytes-in-length"
]
,
{'\n'}
{' '}cookieSerializeOptions
:
{'{'}
{'\n'}
{' '}path
:
"/"
,
{'\n'}
{' '}httpOnly
:
true
,
{'\n'}
{' '}secure
:
false
,
// Set this to true on HTTPS environments
{'\n'}
{' '}sameSite
:
"lax"
as
const
,
{'\n'}
{' '}maxAge
:
12
*
60
*
60
*
24
,
// Twelve days
{'\n'}
{' '}
{'}'}
,
{'\n'}
{' '}serviceAccount
:
{'{'}
{'\n'}
{' '}projectId
:
"your-firebase-project-id"
,
{'\n'}
{' '}clientEmail
:
"firebase-adminsdk-nnw48@your-firebase-project-id.iam.gserviceaccount.com"
,
{'\n'}
{' '}privateKey
:
"-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n"
,
{'\n'}
{' '}
{'}'}
,
{'\n'}
{' '}
{'}'});
{'\n'}
{'}'}
{'\n'}
{'\n'}
export
const
config
=
{'{'}
{'\n'}
{' '}matcher
:
[
"/api/login"
,
"/api/logout"
,
"/"
,
"/((?!_next|favicon.ico|api|.*\\.).*)"
]
,
{'\n'}
{'}'};
)
},
{
name: 'app/layout.tsx',
code: (
import
{' '}
{'{'} cookies {'}'}{' '}
from
"next/headers"
;
{'\n'}
import
{'{'}
{' '}
getTokens {'}'}{' '}
from
"next-firebase-auth-edge"
;
{'\n'}
{'\n'}
export
default
async
function
RootLayout
({'{'}
{'\n'}
{' '}children
,
{'\n'}
{'}'}
:
{'{'}
{'\n'}
{' '}children
:
JSX
.
Element
{'\n'}
{'}'}) {'{'}
{'\n'}
{' '}
const
tokens
=
await
getTokens
(
cookies
()
,
{'{'}
{'\n'}
{' '}apiKey
:
'XXxxXxXXXxXxxxxx_XxxxXxxxxxXxxxXXXxxXxX'
,
{'\n'}
{' '}cookieName
:
'AuthToken'
,
{'\n'}
{' '}cookieSignatureKeys
:
[
'Key-Should-Be-at-least-32-bytes-in-length'
]
,
{'\n'}
{' '}serviceAccount
:
{'{'}
{'\n'}
{' '}projectId
:
'your-firebase-project-id'
,
{'\n'}
{' '}clientEmail
:
'firebase-adminsdk-nnw48@your-firebase-project-id.iam.gserviceaccount.com'
,
{'\n'}
{' '}privateKey
:
'-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n'
{'\n'}
{' '}
{'}'}
{'\n'}
{' '}
{'}'});
{'\n'}
{'\n'}
{' '}
return
(
{'\n'}
{' '}<
html
lang
=
"en"
>
{'\n'}
{' '}<
head
/>
{'\n'}
{' '}<
body
>
{'\n'}
{' '}
{'{'}
/* ... */
{'}'}
{'\n'}
{' '}</
body
>
{'\n'}
{' '}</
html
>
{'\n'}
{' '});
{'\n'}
{'}'}
)
}
];
export default function HeroCode() {
const [fileIndex, setFileIndex] = useState(0);
return (
{files[fileIndex].code}