LS,
When i follow you youtube vid and use your code (very usefull good explained by the way:)), i get these errors, when i use Postman.
Quote: " App is listening on url http://localhost:8080
[2022-04-13T17:23:18.631Z] @firebase/firestore: Firestore (8.10.1): Connection GRPC stream error. Code: 7 Message: 7 PERMISSION_DENIED: Permission denied on resource project "startapplicatie",.
(I named my app: startapplicatie).
In your code (o.a. .env) you use a database-url > this no longer exists in Firestore (at least i can not find it).
I tried the solution to use the Firebase SDK (see: https://firebase.google.com/docs/admin/setup#windows)
npm install firebase-admin --save
according to the instructions on this webpage i generated a new private key (Applicationname / Projectsettings / Service Accounts)
I saved this in my app directory (same level as config.js)
I copied the Node.js code (Admin SDK configuration snippet)
===== code -snippet
var admin = require("firebase-admin");
var serviceAccount = require("path/to/serviceAccountKey.json");
admin.initializeApp({
credential: admin.credential.cert(serviceAccount)
});
=== end code snippet ==
Then i copied the Node.js code into the db.js file like so >
==== code db.js
_const firebase = require('firebase');
const config = require('./config');
var admin = require("firebase-admin");
var serviceAccount = require("./startapplicatie-firebase-adminsdk-crck2-2b088c6e08.json");
admin.initializeApp({
credential: admin.credential.cert(serviceAccount)
});
// with this contact with the database
const db = firebase.initializeApp(config.firebaseConfig);
module.exports = db;_
==== code end ==
But when i use npm start > and Postman > i get the same message;
Code: 7 Message: 7 PERMISSION_DENIED:
Q: where do i have to put the node.js snippet?
Can you or someone else help me out?
Thanks
LS,
When i follow you youtube vid and use your code (very usefull good explained by the way:)), i get these errors, when i use Postman.
Quote: " App is listening on url http://localhost:8080
[2022-04-13T17:23:18.631Z] @firebase/firestore: Firestore (8.10.1): Connection GRPC stream error. Code: 7 Message: 7 PERMISSION_DENIED: Permission denied on resource project "startapplicatie",.
(I named my app: startapplicatie).
In your code (o.a. .env) you use a database-url > this no longer exists in Firestore (at least i can not find it).
I tried the solution to use the Firebase SDK (see: https://firebase.google.com/docs/admin/setup#windows)
npm install firebase-admin --save
according to the instructions on this webpage i generated a new private key (Applicationname / Projectsettings / Service Accounts)
I saved this in my app directory (same level as config.js)
I copied the Node.js code (Admin SDK configuration snippet)
===== code -snippet
var admin = require("firebase-admin");
var serviceAccount = require("path/to/serviceAccountKey.json");
admin.initializeApp({
credential: admin.credential.cert(serviceAccount)
});
=== end code snippet ==
Then i copied the Node.js code into the db.js file like so >
==== code db.js
_const firebase = require('firebase');
const config = require('./config');
var admin = require("firebase-admin");
var serviceAccount = require("./startapplicatie-firebase-adminsdk-crck2-2b088c6e08.json");
admin.initializeApp({
credential: admin.credential.cert(serviceAccount)
});
// with this contact with the database
const db = firebase.initializeApp(config.firebaseConfig);
module.exports = db;_
==== code end ==
But when i use npm start > and Postman > i get the same message;
Code: 7 Message: 7 PERMISSION_DENIED:
Q: where do i have to put the node.js snippet?
Can you or someone else help me out?
Thanks