René's URL Explorer Experiment


Title: Feature request: add support for multiple firebase projects · Issue #1240 · angular/angularfire · GitHub

Open Graph Title: Feature request: add support for multiple firebase projects · Issue #1240 · angular/angularfire

X Title: Feature request: add support for multiple firebase projects · Issue #1240 · angular/angularfire

Description: Hi, thank you for the awesome library, especially the 5.0, it's forming to be the holy grail of angular apps with Firestore. I need to use multiple projects with Angularfire, and currently it's not as developer friendly as it could be. I...

Open Graph Description: Hi, thank you for the awesome library, especially the 5.0, it's forming to be the holy grail of angular apps with Firestore. I need to use multiple projects with Angularfire, and currently it's not...

X Description: Hi, thank you for the awesome library, especially the 5.0, it's forming to be the holy grail of angular apps with Firestore. I need to use multiple projects with Angularfire, and currently it&#...

Opengraph URL: https://github.com/angular/angularfire/issues/1240

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.114.4


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Feature request: add support for multiple firebase projects","articleBody":"Hi,\r\n\r\nthank you for the awesome library, especially the 5.0, it's forming to be the holy grail of angular apps with Firestore.\r\n\r\nI need to use multiple projects with Angularfire, and currently it's not as developer friendly as it could be. \r\n\r\nI request to have either\r\n\r\n1. Builtin support for bootstrapping and injecting multiple instances of the app, database, firestore, auth etc. or...\r\n2. Documentation level blueprint how to do it yourself\r\n\r\n#1026 touches this issue a bit, but as far as I can see there is no final resolution.\r\n\r\nAs far as I can see the core Firebase library has support for this, and the Angularfire2 bootstrapping mechanism even takes the app id as parameter, but that is not really used anywhere and the different providers inject just the default app instance.\r\n\r\nOption 1. could be implemented as one central service that would keep track of different FirebaseApps and have a map of those as well as different services (Database, Auth, Firestore etc.) that would be keyed by the app name. \r\n\r\nAngularFireModule.initializeApp should be changed to take in multiple pairs of FirebaseAppConfig and appName. The first one would be the one that is used when using the normal, current injection. This way the backwards compatibility would be top notch.\r\n\r\nThe initialization logic would loop through the different configs, and set those to the central service and it's maps + return the same module definitions as the current implementation returns.\r\n\r\n```typescript\r\nimports: [\r\n  AngularFireModule.initializeApp(environment.myFirebaseConfig1, 'firebase1', environment.myFirebaseConfig2, 'firebase2')\r\n]\r\n```\r\n\r\nThis would enable us to use this in components or services:\r\n\r\n```typescript\r\n...\r\nexport class LoginComponent implements OnInit, AfterContentChecked {\r\n\r\n  private auth1: AngularFireAuth\r\n  private auth2: AngularFireAuth\r\n\r\n  constructor(\r\n    private auth: AngularFireAuth, //This would be the default, configured using myFirebaseConfig1 above\r\n    private angularFireService: AngularFireService //New service, containing all confs and related services\r\n) {\r\n    this.auth1 = auth\r\n    this.auth2 = angularFireService.getAuth('firebase2') //the same id as given in initializeApp call above\r\n  }\r\n...\r\n```\r\n\r\nThis is also forward compatible if Angular ever supports more sophisticated injection methods.(somekind of markers or other ways to allow injection of different instances of the same class)\r\n\r\nOption 2. would be simply documenting something along these lines: \r\n\r\napp.module.ts:\r\n```typescript\r\nimport { MyAngularFireAuth, MyAngularFireDatabase, MyAngularFirestore, MyFirebaseApp, _firebaseAppFactory } from './angularfire.extensions'\r\n\r\n@NgModule({\r\n...\r\nproviders: [\r\n    { provide: MyFirebaseApp, useValue: _firebaseAppFactory(environment.myOtherFirebaseConfig, 'myFirebase') },\r\n    { provide: MyAngularFirestore, deps: [MyFirebaseApp], useFactory: \r\n      (myFirebaseApp: MyFirebaseApp): MyAngularFirestore => { \r\n        return new MyAngularFirestore(myFirebaseApp, true) \r\n      }\r\n    },\r\n    { provide: MyAngularFireAuth, deps: [MyFirebaseApp], useFactory: \r\n      (myFirebaseApp: MyFirebaseApp): MyAngularFireAuth => { \r\n        return new MyAngularFireAuth(myFirebaseApp) \r\n      }\r\n    },\r\n    { provide: MyAngularFireDatabase, deps: [MyFirebaseApp], useFactory: \r\n      (myFirebaseApp: MyFirebaseApp): MyAngularFireDatabase => { \r\n        return new MyAngularFireDatabase(myFirebaseApp) \r\n      }\r\n    }\r\n  ]\r\n...\r\n})\r\nexport class AppModule { }\r\n```\r\n\r\nangularfire.extensions.ts:\r\n```typescript\r\nimport { FirebaseApp, FirebaseAppConfig } from 'angularfire2'\r\nimport { AngularFireAuth } from 'angularfire2/auth'\r\nimport { AngularFireDatabase } from 'angularfire2/database'\r\nimport { AngularFirestore } from 'angularfire2/firestore'\r\n\r\nimport * as firebase from 'firebase'\r\n\r\nexport function _firebaseAppFactory(config: FirebaseAppConfig, appName?: string): FirebaseApp {\r\n  try {\r\n    if (appName) {\r\n      return firebase.initializeApp(config, appName) as FirebaseApp;\r\n    } else {\r\n      return firebase.initializeApp(config) as FirebaseApp;\r\n    }\r\n  }\r\n  catch (e) {\r\n    if (e.code === \"app/duplicate-app\") {\r\n      return firebase.app(e.name) as FirebaseApp;\r\n    }\r\n\r\n    return firebase.app(null!) as FirebaseApp;\r\n  }\r\n}\r\n\r\nexport class MyAngularFireAuth extends AngularFireAuth {\r\n  \r\n}\r\n\r\nexport class MyFirebaseApp extends FirebaseApp {\r\n  \r\n}\r\n\r\nexport class MyAngularFireDatabase extends AngularFireDatabase {\r\n  \r\n}\r\n\r\nexport class MyAngularFirestore extends AngularFirestore {\r\n\r\n}\r\n```\r\n\r\nThe above code has been briefly tested and found working.\r\n\r\nObviously regardless which option is chosen, it is required that the underlying code does not make assumptions that there is only one instance of any given class out in the wild. As far as I've red the code we're safe here.","author":{"url":"https://github.com/swftvsn","@type":"Person","name":"swftvsn"},"datePublished":"2017-10-10T08:05:40Z","url":"https://github.com/angular/angularfire/issues/1240"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:5fc0e352-a436-6e62-d57d-00d1bf388640
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idE3CA:1EDA:EA652C:138683D:6B0366D6
html-safe-nonce07938ee194e310f6c852683e86821ecd4376c17c313f49c228014fa18e9087a1
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFM0NBOjFFREE6RUE2NTJDOjEzODY4M0Q6NkIwMzY2RDYiLCJ2aXNpdG9yX2lkIjoiNDUyODg4ODQzOTU1NDQwMjAwNiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacad41b30785e254e5f0392fcec27a79313c1aee8f98bef2f927bedfe2a0cfbf60
hovercard-subject-tagissue:264133966
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angularfire/1240/issue_layout
twitter:imagehttps://opengraph.githubassets.com/fbe5c52563fb4f8f7ae16a6569b443c10675f738fe6233ea7c0d63197036c028/angular/angularfire/issues/1240
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/fbe5c52563fb4f8f7ae16a6569b443c10675f738fe6233ea7c0d63197036c028/angular/angularfire/issues/1240
og:image:altHi, thank you for the awesome library, especially the 5.0, it's forming to be the holy grail of angular apps with Firestore. I need to use multiple projects with Angularfire, and currently it's not...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameswftvsn
hostnamegithub.com
expected-hostnamegithub.com
None87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456
turbo-cache-controlno-preview
go-importgithub.com/angular/angularfire git https://github.com/angular/angularfire.git
octolytics-dimension-user_id139426
octolytics-dimension-user_loginangular
octolytics-dimension-repository_id49453413
octolytics-dimension-repository_nwoangular/angularfire
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id49453413
octolytics-dimension-repository_network_root_nwoangular/angularfire
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release423dbb54c5e7bfecc838eb387c1435eb3d0e760d
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/angular/angularfire/issues/1240#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangularfire%2Fissues%2F1240
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangularfire%2Fissues%2F1240
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=angular%2Fangularfire
Reloadhttps://github.com/angular/angularfire/issues/1240
Reloadhttps://github.com/angular/angularfire/issues/1240
Reloadhttps://github.com/angular/angularfire/issues/1240
angularhttps://github.com/angular
angularfirehttps://github.com/angular/angularfire
Codehttps://github.com/angular/angularfire
Issues162 (162)https://github.com/angular/angularfire/issues
Pull requests5 (5)https://github.com/angular/angularfire/pulls
Discussionshttps://github.com/angular/angularfire/discussions
Actionshttps://github.com/angular/angularfire/actions
Projectshttps://github.com/angular/angularfire/projects
Security and qualityhttps://github.com/angular/angularfire/security
Insightshttps://github.com/angular/angularfire/insights
https://github.com/angular/angularfire
New issuehttps://github.com/login?return_to=https://github.com/angular/angularfire/issues/1240
New issuehttps://github.com/login?return_to=https://github.com/angular/angularfire/issues/1240
Feature request: add support for multiple firebase projectshttps://github.com/angular/angularfire/issues/1240#top
https://github.com/swftvsn
swftvsnhttps://github.com/swftvsn
on Oct 10, 2017https://github.com/angular/angularfire/issues/1240#issue-264133966
#1026https://github.com/angular/angularfire/discussions/1026
swftvsnhttps://github.com/swftvsn
on Oct 10, 2017https://github.com/angular/angularfire/issues/1240#event-1285519078
https://github.com/jamesdaniels
jamesdanielshttps://github.com/jamesdaniels
on Oct 14, 2017https://github.com/angular/angularfire/issues/1240#issuecomment-336603710
https://stackblitz.com/edit/angular-aw3pyc?file=app%2Fapp.component.tshttps://stackblitz.com/edit/angular-aw3pyc?file=app%2Fapp.component.ts
https://angular.io/guide/dependency-injection-in-actionhttps://angular.io/guide/dependency-injection-in-action
jamesdanielshttps://github.com/jamesdaniels
completedhttps://github.com/angular/angularfire/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Oct 14, 2017https://github.com/angular/angularfire/issues/1240#event-1293248531
https://github.com/swftvsn
swftvsnhttps://github.com/swftvsn
on Oct 14, 2017https://github.com/angular/angularfire/issues/1240#issuecomment-336615232
@jamesdanielshttps://github.com/jamesdaniels
https://github.com/nguyenluucuong
nguyenluucuonghttps://github.com/nguyenluucuong
on Oct 17, 2017https://github.com/angular/angularfire/issues/1240#issuecomment-337105106
@jamesdanielshttps://github.com/jamesdaniels
stackblitzhttps://stackblitz.com/edit/angular-aw3pyc?file=app%2Fapp.component.ts
https://user-images.githubusercontent.com/3369539/31644498-e8fae3bc-b320-11e7-8bea-fcc5d02d01fc.png
https://github.com/magleahy
magleahyhttps://github.com/magleahy
on Oct 20, 2017https://github.com/angular/angularfire/issues/1240#issuecomment-338238539
@nguyenluucuonghttps://github.com/nguyenluucuong
https://github.com/swftvsn
swftvsnhttps://github.com/swftvsn
on Oct 24, 2017https://github.com/angular/angularfire/issues/1240#issuecomment-338885041
@nguyenluucuonghttps://github.com/nguyenluucuong
@magleahyhttps://github.com/magleahy
#1305https://github.com/angular/angularfire/issues/1305
https://github.com/james11a
james11ahttps://github.com/james11a
on Jan 31, 2018https://github.com/angular/angularfire/issues/1240#issuecomment-361886105
herehttps://github.com/angular/angularfire2/issues/1305#issuecomment-361884177
https://github.com/jakeleveroni
jakeleveronihttps://github.com/jakeleveroni
on May 2, 2018https://github.com/angular/angularfire/issues/1240#issuecomment-386114155
@jamesdanielshttps://github.com/jamesdaniels
https://github.com/jamesdaniels
jamesdanielshttps://github.com/jamesdaniels
on May 2, 2018https://github.com/angular/angularfire/issues/1240#issuecomment-386115720
https://github.com/tamama
tamamahttps://github.com/tamama
on Aug 17, 2018https://github.com/angular/angularfire/issues/1240#issuecomment-413782769
@jamesdanielshttps://github.com/jamesdaniels
https://github.com/fbayanati
fbayanatihttps://github.com/fbayanati
on Aug 20, 2018https://github.com/angular/angularfire/issues/1240#issuecomment-414193427
stalkblitzhttps://stackblitz.com/edit/angular-or2ehb
stackoverflowhttps://stackoverflow.com/questions/51922195/can-not-have-access-to-multiple-google-firestore-db-in-angular-6-application-wit/51922426#51922426
Sign up for freehttps://github.com/signup?return_to=https://github.com/angular/angularfire/issues/1240
Sign in to commenthttps://github.com/login?return_to=https://github.com/angular/angularfire/issues/1240
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlmax-age=0, private, must-revalidate

Viewport: width=device-width


URLs of crawlers that visited me.