fastboot, ember simple auth and emberfire dont work each other
i tried to work with emberfire and embersimple auth, and followed the instruction, and it worked, but when i tried to use fastboot , it failed, it said " Error: The XMLHttpRequest compatibility library was not found.". I tried to use the guide from embersimple auth, by activated the cookie, yes it worked but the session failed to capture the login from firebase probably due i changed the session-stores to follow the guides from ember-simple-auth website, any idea to work around this problem?
thanks
Same issue. I gave up using emberfire. Instead I did this workaround.
- Installed the package
npm install xmlhttprequest --save. It'll likely save 'ember-fetch' in your package.json but xmlhttprequest is a dependency of it.
Added xmlhttprequest to fastbootdependencies in package.json
{
"dependencies": {
"xmlhttprequest": "1.8.0"
},
"fastbootDependencies": [
"xmlhttprequest"
]
}
- Downloaded
firebase/appandfirebase/authand imported them in my ember-cli-build.js.
app.import('vendor/firebase-app.js');
app.import('vendor/firebase-auth.js');
- Added 2 files in an
app/instance-initializersfolder
- The first was firebase.js file to initialize firebase.
export function initialize(applicationInstance) {
if (firebase.apps.length === 0) {
var firebaseConfig = {
...
}
firebase.initializeApp(firebaseConfig);
}
}
export default {
initialize
};
- The second was a xmlhttprequest.js file to require the library in Fastboot
export function initialize(applicationInstance) {
if (typeof FastBoot !== 'undefined') {
window.XMLHttpRequest = FastBoot.require('xmlhttprequest').XMLHttpRequest;
}
}
export default {
initialize
};
- Added
firebaseas a global to my.eslintrc.jsfile so I don't get any errors compiling.
globals: {
firebase: "readonly"
},
Done. I was able to console.log(firebase.auth()) from my Ember Service without the XMLHttpRequest error and I saw the output in both my terminal and the browser.
many thanks, can we use the firebase that you just initialize to work on firestore?