Skip to content

Auth Emulator Bug verification session on refresh page with getAccountInfo #465

@tibs245

Description

@tibs245

Version

"nuxt": "^2.15.1",
"firebase": "^8.2.8",
"@nuxtjs/proxy": "^2.1.0",
"@nuxtjs/pwa": "^3.3.5",
"@nuxtjs/firebase": "^7.5.0",
"core-js": "^3.9.0",

Steps to reproduce

  • Use Firestore auth with emulator
  • Connect user
  • Refresh the page (F5 or CTRL + R)

(In this exemple, my Auth emulator is http://localhost:9099)

What is Expected?

But fail because this session not exist on google server
So I am disconnected each time the page is refreshed

What is actually happening?

The firebase must to send the request getAccountInfo for valid the session to : http://localhost:9099/www.googleapis.com/identitytoolkit/v3/relyingparty/getAccountInfo

I don't know if this a Nuxt Firebase module bug, a firebase bug or me with a bad configuration. If it's firebase bug, I am sorry for this issue.

But for resolve this bug temporary I have edit the firebase auth service worker and it's work.

I edit : static/firebase-auth-sw.js

  if (!expectsHTML || !isSameOrigin || !isHttps || isIgnored) {
+    if (event.request.url.startsWith('https://www.googleapis.com/identitytoolkit/')) {
+     event.respondWith(
+        fetch({
+          ...event.request,
+          ...{ url: event.request.url.replace(/https:\/\//, 'http://localhost:9099/') },
+        })
+      )
+    } else event.respondWith(fetch(event.request))
-    event.respondWith(fetch(event.request))
    return
  }

But I think It's not the better way for resolve it

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions