Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

252
Visualizações
How to add Firebase JWT to an Angular HTTP Request?

I have my own HTTP Service which provides GET, POST, PUT and DELETE methods and enables me to send the JWT from my Firebase user in the HTTP request header.

Now I'm able to get my user object from a redux store, and I can retrieve the JWT via the getIdToken() method on this user object. Unfortunately this method provides me with a Promise<string>.

Is there any way, I can build my Http-Options Object with this JWT-Header, before actually sending the request via Angular's HttpClient?

My Code:

async delete<T = any>(appendix: string): Observable<T> {
  const options: any = await this.httpOptions();
  return this.http.delete<T>(this.url + appendix, options);
}
    
private async httpOptions(): Promise<{ headers: { uid: string } }> {
  const user: User = this.authQuery.getValue();
  const token: string = await user.getIdToken().catch();
  return {
    headers: {uid: token},
  };
}
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda