Missing uid when using local emulator suite
See original GitHub issueI’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:
- Setup Local Emulator Suite and Example Project
- Configure Emulator Suite
- Create firebase user using the emulator ui
- 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:
- Created 2 years ago
- Reactions:1
- Comments:12 (3 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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.
Same issue as above. Any help would be appreciated