legacy-modules icon indicating copy to clipboard operation
legacy-modules copied to clipboard

@nuxtjs/firebase returns 404

Open andreliem opened this issue 8 years ago • 7 comments

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
This question is available on Nuxt.js community (#c81)

andreliem avatar Aug 25 '17 20:08 andreliem

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.

pi0 avatar Aug 25 '17 21:08 pi0

Thanks @pi0 , much appreciated!

andreliem avatar Aug 25 '17 21:08 andreliem

@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 avatar Aug 26 '17 22:08 andreliem

@andreliem I'll keep this thread updated for new SSR changes.

pi0 avatar Aug 28 '17 21:08 pi0

Any plan for continues Firebase-Module develop?

kieuminhcanh avatar Nov 17 '17 08:11 kieuminhcanh

the links are dead!

ramstein74 avatar Aug 20 '18 10:08 ramstein74

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

kakha13 avatar Dec 13 '20 21:12 kakha13