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

initialise same app for firestore and auth #1821

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

Conversation

snehmehta
Copy link
Collaborator

Ticket: #1812

@snehmehta snehmehta linked an issue Jan 8, 2025 that may be closed by this pull request
@@ -58,7 +58,7 @@ class FirestoreAPIProvider extends APIProvider with LiveAPIProvider {
} else {
// Initialize the new Firebase app with the options
FirebaseApp app = await Firebase.initializeApp(
name: appId,
name: 'customFirebase',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

huh?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

firebase auth initialisation:

return await Firebase.initializeApp(
name: 'customFirebase', options: options);

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand, my question was why hardcode the name of the app? is it supposed to match something somewhere else? where?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we just need to name firebase app, since we have ensemble firebase app initialised.
Only the firebase auth and firestore need to match the name of firebase app.

Either way we'll need to have single initialisation of firebase service to not worry about matching everywhere.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the reason I did it this way was to allow multiple apps to run in Ensemble Go and the Studio. That use case will fail if we hardcode the app name right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, we can keep firestore initialisation as it is and update the auth side.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes - on the auth side we can just use the appId as well and then the two will be the same right? I am not sure if that'll be an issue or not?

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.

Firebase Auth to be accessible by Firestore calls
2 participants