Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

279
Vistas
Getting firebase realtime database sending an oauth token (Angular iframe)

I currently have an iframe which i embeed in my site, in a chrome extension and in 3rd party sites.

The problem is the following: I'm populating parts of my iframe with firebase data. In my site, i embeed my own iframe and is protected by a firebase token (the views), i don't know exactly how it works, but it returns the data correctly when calling the DB. Example:

 getData(
    reference: string,
  ){
    const ref = `accounts/${reference}`;
    const dataReturn = this.db.object(ref).valueChanges();
    return dataReturn;
  }

This returns just fine on my webapp, when the user logouts in my webapp, then the data is protected (as it has to be)

The problem begins here: When a 3rd party embeeds my iframe, they use an oAuth token (to get users, etc from my API), so they're not logged in my website, hence, when they embeed and try to get the data (automatically, since we call firebase onInit), they get blocked by firebase because they don't have a valid token/they're not authenticated in my website.

Is there a way to use that oAuth token to let them get the firebase data?

Same escenario happens in the chrome extension, we make the user log-in using an oAuth token (to prevent making an account and logging in in our webapp, preventing CORS issues).

These are my rules in realtime database firebase:

"accounts": {
            ".read": "auth !== null",
            ".write": false,
    }

Thank you!

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

If the OAuth token is from a collaborator on the Firebase project and that collaborator has access to the Realtime Database, the client will have that same access to the database too.

Their API calls will in that case bypass the security rules of your database, just as when the collaborator would sign in to the Firebase console and access the database there.

about 4 years ago · Juan Pablo Isaza Denunciar

0

Ok.. so for anyone wondering.. a coworker resolved this issue by sending the oAuth token to our backend, and returning from there a valid firebase token. With that token, we just sign-in with signInWithCustomToken() firebase function (of course applying logic so just oAuth users can actually use this automatically). That way my users have access to realtime database since they're authenticated in firebase

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda