legacy-modules
legacy-modules copied to clipboard
@nuxtjs/firebase returns 404
I'm trying to add firebase to my nuxt app but I'm getting this 404.
Curious if it's still working?
npm install @nuxtjs/firebase --save
npm ERR! code E404
npm ERR! 404 Not Found: @nuxtjs/firebase@latest
Hi @andreliem unfortunately, the firebase module is not stabilized yet. (As of some security concerns with SSR usage). Meanwhile, i suggest you using the code from nuxt hacker news which has a complete firebase integration but just without module. The most important parts:
For alias: https://github.com/nuxt/hackernews/blob/master/nuxt.config.js#L4
Server side caching: https://github.com/nuxt/hackernews/blob/master/api/create-api-server.js
Client side: https://github.com/nuxt/hackernews/blob/master/api/create-api-client.js
BTW here is the code of plugin which firebase module should provide soon if interested to test it: https://github.com/nuxt-community/modules/blob/master/modules/firebase/plugin.js
Let me know how things go for you.
Thanks @pi0 , much appreciated!
@pi0 I should probably ask this elsewhere, but I was wondering if you have any recommendations on how to implement a firebase authentication check that will commit a mutation about the user's authentication state?
I'm using the firebase hackernews example with the api code, and then tried to add a middleware file as follows.
middleware/auth-check.js
import { isLoggedIn } from '../api'
export default function ({store}) {
isLoggedIn().then((loggedIn) => {
store.commit('SET_AUTH_LOGGED_IN', loggedIn)
})
}
api/index.js
export async function isLoggedIn () {
await _api
let currentUser = firebase.auth().currentUser
return !!currentUser
}
But this doesn't seem to work. It's complaining that the API Key for firebase is invalid, so seems like it's an issue with when the middleware is ran, not waiting for the _api to properly load.
Is there somewhere else I should be running an auth check like this?
@andreliem I'll keep this thread updated for new SSR changes.
Any plan for continues Firebase-Module develop?
the links are dead!
So I have static site uploaded to my HostGator server and it was giving me 404 error page for firebase pages. I added this code to .htaccess
<ifModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.html [QSA,L]
</ifModule>
And it's working now