GitShow/colinhacks/next-firebase-ssr
colinhacks

next-firebase-ssr

An Next.js example repo for building authenticated pages with Firebase Authentication, cookies, and getServerSideProps

by colinhacks
authenticationfirebasefirebase-authnextjsssr
Star on GitHubForkWebsitenpm

TypeScript

426 stars57 forks7 contributorsQuiet · 3y agoSince 2020

Meet the team

See all 7 on GitHub →
colinhacks
colinhacks6 contributions
ivanjeremic
ivanjeremic1 contribution
stephensilber
stephensilber1 contribution
subwaymatch
subwaymatch1 contribution
imjared
imjared1 contribution
wRWebDev
wRWebDev1 contribution

Recent PRs & issues

Quiet · 2 in progress · Last activity 3y ago
See all on GitHub →
hiddenmyth
Cannot read properties of undefined (reading 'apps')OpenIssue

Unhandled Runtime Error TypeError: Cannot read properties of undefined (reading 'apps') Call Stack eval webpack-internal:///./firebaseClient.js (25:68) ./firebaseClient.js file:///D:/WORK/PROJECTS/PAID/dashboard-forex/.next/static/chunks/pages/management/transactions.js (2412:1) options.factory /_next/static/chunks/webpack.js (621:31) __webpack_require__ file:///D:/WORK/PROJECTS/PAID/dashboard-forex/.next/static/chunks/webpack.js (37:33) fn /_next/static/chunks/webpack.js (276:21) eval webpack-internal:///./src/layouts/SidebarLayout/Header/Userbox/index.js (19:72) ./src/layouts/SidebarLayout/Header/Userbox/index.js file:///D:/WORK/PROJECTS/PAID/dashboard-forex/.next/static/chunks/pages/management/transactions.js (2599:1) options.factory /_next/static/chunks/webpack.js (621:31) __webpack_require__ file:///D:/WORK/PROJECTS/PAID/dashboard-forex/.next/static/chunks/webpack.js (37:33) fn /_next/static/chunks/webpack.js (276:21) eval webpack-internal:///./src/layouts/SidebarLayout/Header/index.js (11:66) ./src/layouts/SidebarLayout/Header/index.js file:///D:/WORK/PROJECTS/PAID/dashboard-forex/.next/static/chunks/pages/management/transactions.js (2610:1) options.factory /_next/static/chunks/webpack.js (621:31) __webpack_require__ file:///D:/WORK/PROJECTS/PAID/dashboard-forex/.next/static/chunks/webpack.js (37:33) fn /_next/static/chunks/webpack.js (276:21) eval webpack-internal:///./src/layouts/SidebarLayout/index.js (8:65) ./src/layouts/SidebarLayout/index.js file:///D:/WORK/PROJECTS/PAID/dashboard-forex/.next/static/chunks/pages/management/transactions.js (2643:1) options.factory /_next/static/chunks/webpack.js (621:31) __webpack_require__ file:///D:/WORK/PROJECTS/PAID/dashboard-forex/.next/static/chunks/webpack.js (37:33) fn /_next/static/chunks/webpack.js (276:21) eval webpack-internal:///./pages/management/transactions/index.js (6:83) ./pages/management/transactions/index.js file:///D:/WORK/PROJECTS/PAID/dashboard-forex/.next/static/chunks/pages/management/transactions.js (2445:1) options.factory /_next/static/chunks/webpack.js (621:31) __webpack_require__ file:///D:/WORK/PROJECTS/PAID/dashboard-forex/.next/static/chunks/webpack.js (37:33) fn /_next/static/chunks/webpack.js (276:21) eval node_modules\next\dist\build\webpack\loaders\next-client-pages-loader.js?absolutePagePath=D%3A%5CWORK%5CPROJECTS%5CPAID%5Cdashboard-forex%5Cpages%5Cmanagement%5Ctransactions%5Cindex.js&page=%2Fmanagement%2Ftransactions! (5:15) eval node_modules\next\dist\client\route-loader.js (235:50)

hiddenmyth · 3y ago
davidwitten
Redirect on first load of authenticated pageOpenIssue

I followed the example and redirected when the page isn't authenticated: https://github.com/colinhacks/next-firebase-ssr/blob/master/pages/authenticated.tsx#L25 As a result, when I load my website for the first time in a while, it redirects to /404. When I reload my authenticated page it works (bc the website regenerates my token). Is there any way to resolve this? What's the preferred way to refresh your token? This is my full error message:

davidwitten · 4y ago
Nithur-M
What is the best way to use this approach in multiple protected routes?OpenIssue

Should I write the same logic again and again to deny access to multiple protected routes for unauthenticated users? or is there any elegant way to deal with this? Thank you.

Nithur-M · 4y ago

Recent fixes

View closed PRs →
wirths
chore: upgrade React, next, firebase & firebase-adminMergedPR

New versions: NextJS links amended and firebase code refactored.

wirths · 5mo ago
benjaminben
Compatibility when hosting via Firebase FunctionsClosedIssue

Thanks so much for this very helpful example repo. I wanted to leave a note here (since it was where I initially searched for the solution) that the cookie name is not compatible as of writing with Firebase's experimental support for turnkey Next.js deployments. This is because Firebase Functions only accept one cookie by the name of . (SO source) While the example provided in this repo worked fine in development, the call to would fail in production due to Firebase stripping the cookie. I switched the saved cookie's name to in both the and in and that resolved the issue for me, not sure if there are any potential pitfalls of doing this.

benjaminben · 3y ago
ImDino
remove duplicate commentsMergedPR

self-explanatory :)

ImDino · 3y ago
Structured data for AI agents

Repository: colinhacks/next-firebase-ssr. Description: An Next.js example repo for building authenticated pages with Firebase Authentication, cookies, and getServerSideProps Stars: 426, Forks: 57. Primary language: TypeScript. Homepage: https://vriad.com/essays/nextjs-firebase-authentication Topics: authentication, firebase, firebase-auth, nextjs, ssr. Open PRs: 2, open issues: 8. Last activity: 3y ago. Top contributors: colinhacks, ivanjeremic, stephensilber, subwaymatch, imjared, wRWebDev.

·@ofershap

Replace github.com with gitshow.dev