question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Missing uid when using local emulator suite

See original GitHub issue

I’m currently trying to setup next.js authentication with this library and the firebase emulator suite. I had success connecting the next-firebase-auth with our cloud test instance but no success with the emulator. Every login attempt fails with an auth/argument-error where the uid is null.

Versions

next-firebase-auth version: ^0.14 Firebase JS SDK: ^8.9.1 Next.js: 12.0.7 Firebase Tools in Docker: 10.0.1

To Reproduce Steps to reproduce the behavior:

  1. Setup Local Emulator Suite and Example Project
  2. Configure Emulator Suite
  3. Create firebase user using the emulator ui
  4. Attempt a login

The exception occurs when calling BaseAuth.createCustomToken.

BaseAuth.prototype.createCustomToken = function (uid, developerClaims) {
  return this.tokenGenerator.createCustomToken(uid, developerClaims);
};

Error

errorInfo: {
  code: 'auth/argument-error',
  message: '`uid` argument must be a non-empty string uid.'
}

Emulator Export

{
  "kind": "identitytoolkit#DownloadAccountResponse",
  "users": [
    {
      "uid": "5e9d49ecc652bf25ef18c461",
      "localId": "tjPIPI6VuxrhwNi5gKi8prsaJoRv",
      "createdAt": "1641059106748",
      "lastLoginAt": "1641059106748",
      "displayName": "John Doe",
      "photoUrl": "",
      "emailVerified": false,
      "email": "test@test.com",
      "salt": "fakeSalt1pE9Vg0uDz5b1JTNSNVA",
      "passwordHash": "fakeHash:salt=fakeSalt1pE9Vg0uDz5b1JTNSNVA:password=movement",
      "passwordUpdatedAt": 1641059106757,
      "validSince": "1641059106",
      "providerUserInfo": [
        {
          "providerId": "password",
          "email": "test@movementsnacks.com",
          "federatedId": "test@movementsnacks.com",
          "rawId": "test@movementsnacks.com",
          "displayName": "John Doe",
          "photoUrl": ""
        }
      ],
      "customAttributes": "{\"role\": \"admin\"}",
      "lastRefreshAt": "2022-01-01T17:45:06.758Z"
    }
  ]
}

Environment

FIREBASE_CLIENT_EMAIL=<test-cloud-environment-mail>
NEXT_PUBLIC_FIREBASE_PUBLIC_API_KEY=<test-cloud-environment-api-key>
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=<test-cloud-environment-domain>
NEXT_PUBLIC_FIREBASE_PROJECT_ID=movement-snacks-test

FIREBASE_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----......-----END PRIVATE KEY-----"

COOKIE_SECRET_CURRENT=someSecretValue
COOKIE_SECRET_PREVIOUS=anotherSecretValue

NEXT_PUBLIC_COOKIE_SECURE=false

FIREBASE_AUTH_EMULATOR_HOST="localhost:9099"

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
kmjennisoncommented, Jan 8, 2022

OK, thanks. I’ll investigate this when I can make the time, though that probably won’t be for a little while. Hopefully, others who have set up the emulator can weigh in here with suggestions.

2reactions
MingCherrycommented, Jan 23, 2022

Same issue as above. Any help would be appreciated

Read more comments on GitHub >

github_iconTop Results From Across the Web

Install, configure and integrate Local Emulator Suite - Firebase
The Firebase Local Emulator Suite can be installed and configured for different prototype and test environments, anything from one-off prototyping sessions ...
Read more >
View authenticated users in Firebase Emulator when using ...
I've noticed that when using this the user accounts do not show up in Firestore's UI anymore. The same goes for the local...
Read more >
"Missing or insufficient permissions." error using emulators
I started the emulators and created a user in authentication. After successfully signing in with email and password my app reads from a...
Read more >
Initialise your Firebase Auth & Firestore emulator with initial ...
Image from Introduction to Firebase Local Emulator Suite ... gets all the users from firestore, and creates the users with the same uid...
Read more >
How to Emulate Firebase Auth | Harvtronix
Even though Firebase has a super amazing Emulator Suite for local testing ... My app in particular is using Google Login and the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found