firebase-realtime-database

How to impersonate the database authentication from Firebase Cloud Function with admin privileges?

六月ゝ 毕业季﹏ 提交于 2020-08-08 04:30:06
问题 I have a set of Firebase Functions that works as an API for an application. These Firebase Functions connect to the database with admin privileges as this: const serviceAccount = require(`./config/xxx-firebase-adminsdk.json`); admin.initializeApp({ credential: admin.credential.cert(serviceAccount), databaseURL: DATABASE_URL, }); I was able to create a custom token and I'm receiving/decoding it in the server but I cannot make use of the security rules because the Firebase function is

Firebase-functions-test “The default Firebase app does not exist.”

我的未来我决定 提交于 2020-08-07 03:25:17
问题 I've begun using the new firebase-functions-test testing SDK to unit test my Cloud Firestore functions. When I run my tests via npm test I am getting the following error: The default Firebase app does not exist. Make sure you call initializeApp() before using any of the Firebase services My method is very similar to the makeUppercase method found within the quickstarts samples, and thus I have mainly copied the test from the test.js file. describe('updateActiveNotesCount', () => { // Test

Firebase-functions-test “The default Firebase app does not exist.”

只愿长相守 提交于 2020-08-07 03:24:19
问题 I've begun using the new firebase-functions-test testing SDK to unit test my Cloud Firestore functions. When I run my tests via npm test I am getting the following error: The default Firebase app does not exist. Make sure you call initializeApp() before using any of the Firebase services My method is very similar to the makeUppercase method found within the quickstarts samples, and thus I have mainly copied the test from the test.js file. describe('updateActiveNotesCount', () => { // Test

Firebase is not defined?

只谈情不闲聊 提交于 2020-08-06 12:58:05
问题 I'm working on an Angular project and use Firebase, and it's erroring with ReferenceError: Firebase is not defined , but I can not figure out why. this is my index.html <!DOCTYPE html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>My Contacts App</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="bower_components/foundation/css/foundation.css"> <link rel="stylesheet" href="app.css"> </head>

Firebase is not defined?

可紊 提交于 2020-08-06 12:57:06
问题 I'm working on an Angular project and use Firebase, and it's erroring with ReferenceError: Firebase is not defined , but I can not figure out why. this is my index.html <!DOCTYPE html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>My Contacts App</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="bower_components/foundation/css/foundation.css"> <link rel="stylesheet" href="app.css"> </head>

Nodejs Firebase Transaction - Maximum call stack size exceeded

為{幸葍}努か 提交于 2020-08-06 05:23:17
问题 I have a cloud function that uses a transaction to updates the players in a game. When the /players is null, i am trying to return a Map, but i get "Maximum call stack size exceeded". Here is my cloud function: export const addUserToGame = functions.https.onCall((data, context) => { // Expected inputs - game_id(from data) and UID(from context) if (context.auth == null) { return { "status": 403, "message": "You are not authorized to access this feature" }; } const uid = context.auth.uid; const

Firebase iOS - Snapshot isn't updated but database is?

泪湿孤枕 提交于 2020-08-05 13:58:05
问题 I've been having this issue at random times for quite a while, where I will physically be looking at my firebase console and see that I have deleted a piece of data, and then in code I will call print(snapshot.ref) and see the correct reference (copy and pasted in browser to double check too), yet somehow when I try to get the values of the snapshot/iterate over its children the snapshot is containing old data that is not in the database anymore. let key2 = ref.child(users).child("Employees")

How to encrypt user data in Firebase

亡梦爱人 提交于 2020-07-31 06:22:05
问题 I am using the email/password sign in method for Firebase. I would like to encrypt the data users save into the realtime database before sending it to the database. Firebase already handle the user password, but can I somehow use it to encrypt data which can't be decrypted by me only the client? It would be nice if I could achieve it with the client sdk. So my flow would be something like this: User sign in with it's credentials (which is handled by firebase itself) User encrypt some data

How to encrypt user data in Firebase

你离开我真会死。 提交于 2020-07-31 06:21:10
问题 I am using the email/password sign in method for Firebase. I would like to encrypt the data users save into the realtime database before sending it to the database. Firebase already handle the user password, but can I somehow use it to encrypt data which can't be decrypted by me only the client? It would be nice if I could achieve it with the client sdk. So my flow would be something like this: User sign in with it's credentials (which is handled by firebase itself) User encrypt some data

How do I relate new data to a currently logged in user in Firebase?

醉酒当歌 提交于 2020-07-31 04:20:07
问题 I want to add a student list to my Firebase realtime database. When a teacher adds a new student, I want the currently logged-in teachers ID to relate to the student they just added. When I compile the following I get my "Student Added" toast on the emulator but nothing shows up on Firebase - no new parent of "students" and no new entries. Can someone see where I'm going wrong? I think using datasnapshot to get thecurrentUserId from Firebase might be long-winded but when I just used the