usuario users expiration auth all administrador node.js firebase firebase-database firebase-authentication firebase-admin

node.js - users - firebase token expiration



Token de autenticación de Firebase Admin revocado (1)

Me di cuenta de que había creado mi cuenta de servicio en el lugar equivocado. Como yo no era el propietario del proyecto, no era válido. Conseguí que el propietario del proyecto me creara una cuenta de servicio y todo funciona ahora.

Estoy intentando implementar un servidor node.js para escuchar los cambios en mi base de datos de firebase. Este es mi código para inicializar el servidor:

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); });

Con la depuración habilitada, recibo los errores:

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.