5
Próbuję zaimplementować serwer node.js, aby odsłuchać zmiany w mojej bazie danych firebase. To jest mój kod, aby zainicjować serwer:Firebase Admin Auth Token Revoked
var admin = require('firebase-admin');
var serviceAccount = require('./SERVICE-ACCOUNT.json');
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
databaseURL: "https://APP-NAME.firebaseio.com"
});
var db = admin.database();
admin.database.enableLogging(true);
var convRef = db.ref('conversations');
convRef.once('value', function(snapshot) {
console.log("VALUE: " + snapshot.val());
}, function(error) {
console.log("ERROR: " + error.code);
});
Z debugowanie włączone, otrzymuję błędy:
p:0: Listen called for /conversations default
p:0: Making a connection attempt
p:0: Auth token refreshed
getToken() completed. Creating connection.
c:0:0: Connection created
c:0:0:0 Websocket connecting to wss://APP-NAME.firebaseio.com/.ws?v=5
c:0:0:0 Websocket connected.
c:0:0: Reset packet received. New host: s-usc1c-nss-123.firebaseio.com
c:0:0: Shutting down all connections
c:0:0:0 WebSocket is being closed
c:0:0:0 Websocket connection was disconnected.
c:0:0:1 Websocket connecting to wss://s-usc1c-nss-123.firebaseio.com/.ws?v=5&ns=APP-NAME
c:0:0:1 Websocket connected.
c:0:0: Realtime connection established.
p:0: connection ready
p:0: reportStats {"c":{"sdk.js.4-0-4":1}}
p:0: {"r":1,"a":"s","b":{"c":{"sdk.js.4-0-4":1}}}
p:0: {"r":2,"a":"gauth","b":{"cred":"REDACTED"}}
p:0: Listen on /conversations for default
p:0: {"r":3,"a":"q","b":{"p":"/conversations","h":""}}
p:0: from server: {"r":1,"b":{"s":"ok","d":""}}
c:0:0: Primary connection is healthy.
p:0: from server: {"r":2,"b":{"s":"permission_denied","d":"Access denied."}}
Auth token revoked: permission_denied/Access denied.