firebase / firebase/firebase-js-sdk

FR: authentication for server side rendering

Open
#2,096 8 comments 36 reactions 1 assignee Claimed by @avolkovi View on GitHub
api: auth feature request
Dominant language
TypeScript
Stars
5.1k
Forks
1k
Avg merge
2d 21h
Merged PRs (30d)
37

Description

### Environment
* Operating System version: NR
* Browser version: NR
* Firebase SDK version: 6.1.0
* Firebase Product: auth

### Problem
Trying to use Firebase Auth in combination with Server Side Rendering (in Nuxt). The server renders the requested page, and in order to do that it needs to fetch data from Firestore which in turn requires authentication. The page code is isomorphic, on initial request it runs on both the server and client using the JS SDK. Giving the advantages of SSR combined with the benefit of following Firestore rules.

My current solution is to generate a custom token from a refresh token which is pretty slow since three (http) requests are needed in-between to achieve this. Then logging in using `signInWithCustomToken`, diagram to clarify:
![firebase_auth_ssr_nuxt2](https://user-images.githubusercontent.com/5701149/63352800-0d5e3580-c362-11e9-8e88-779b53978b2e.png)

My request would be to make it possible to sign in using a refresh token, if possible? Or add something else to support this use-case.

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.