firebase / firebase/firebase-tools

Make `currentUser` and `firebaseApp` available in NextJS App Router apps

Open
#6,246 0 comments 1 reaction 0 assignees View on GitHub
integration: web frameworks type: feature request
Dominant language
TypeScript
Stars
4.5k
Forks
1.3k
Avg merge
1d 12h
Merged PRs (30d)
84

Description

Per [the docs](https://firebase.google.com/docs/hosting/frameworks/nextjs#optional_integrate_with_firebase_authentication):

> The Express `res.locals` object will optionally contain an authenticated Firebase App instance (`firebaseApp`) and the currently signed-in user (`currentUser`). This can be accessed in `getServerSideProps`.

However, [App Router](https://nextjs.org/docs#app-router-vs-pages-router) apps don't have `getServerSideProps`, so as far as I can tell there isn't a way to access the user on the server in App Router apps. This means that web frameworks' server-side magic that allows the client SDK to be used so that security rules are respected doesn't work.

Not sure how to surface this in the new App Router world, but having a way to access `currentUser` and the `firebaseApp` associated with that user is critical for doing any data access on server render with NextJS

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.