gladly-team / next-firebase-auth

Simple Firebase authentication for all Next.js rendering strategies
https://nfa-example-git-v1x-gladly-team.vercel.app/
MIT License
1.34k stars 290 forks source link

Support a server-side, API-only environment #502

Closed kmjennison closed 2 years ago

kmjennison commented 2 years ago

Is your feature request related to a problem? Please describe.

Developers may want to run next-firebase-auth on the server for some API methods only, never intending to render React DOM or initialize on the client. This is particularly relevant for #223, where it's likely developers will sometimes rely on auth cookies in a backend service separate from the service rendering Next.js pages.

Describe the solution you'd like and how you'd implement it

We should support the minimal dependencies and config settings required for non-React, server-side only functionality.

We began this work in #493, which made some dependencies optional. Additional work is needed to handle exceptions when requireing missing optional dependencies; ex: Cannot find module 'react' from 'index.node.js'.

This may overlap with work required for #207.

Is this a breaking change? No

Describe alternatives you've considered

The alternative is to always require installing dependencies. That's an acceptable fallback if it's too much work to implement these changes.

kmjennison commented 2 years ago

Closed in #512.