Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to do Client only auth with SSR #1564

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

alexandresanchograca
Copy link

@alexandresanchograca alexandresanchograca commented Aug 13, 2024

In my usage I found it lacked the need to support client only Auth with SSR. Currently I only want to do authentication on the client, but still want to fetch firestore data that doesn't require an authenticated user to be able to retrieve this data on the server.

This change should be compatible with all the old versions without any breaking changes.
To only allow authentication on the client during SSR:

    auth: {
      enabled: true,
      clientOnly: true
    }

Before this would require an admin service-account to be included in your project so that the app could fetch the server data, with this check we disable the loading of the plugin-authenticate-user.server, and can start a firebase app on the server without firebaseAuth and retrieve public/accessible data of firestore without needing an authorisation.
When on the client the authorisation will remain enabled and the rest of the data that requires authorisation will be loaded client only.

… This is because we might want do SSR without server authentication, authentication only on the client, since many firestore data are not restricted by authorization or authentication of a user.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant