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

334
Visualizações
Post Website On Github Pages Without Exposing API Key

I created a ReactJS movie website with TMDb movie API and my website fetches data from TMDb server which requires an API key. I have created an .env file and put my API key there and then I added that .env file to my .gitignore file, but now I want to publish my website on github pages without publicly exposing my API key, please help me by suggesting solution to this particular problem.

I have found many questions regarding how to hide my API key, but here, what I am asking is that, how to publish my page with my API key not being publicly accessible.

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

Depending on your usecase, you could use GitHub actions and GitHub secrets to achieve this.

The action could fetch data from the API, making it available during the build. This would almost be like cache warming, fetching upstream data and storing a static version closer to the client. Depending on your usecase, I think something like that would work.

about 4 years ago · Juan Pablo Isaza Relatório

0

Github Pages are supposed to be public for community/free tier. Remove the API key from the code, where ever it is. Store API key as a variable in Github Secrets.

https://docs.github.com/en/actions/security-guides/encrypted-secrets

And then, reference it during pipeline build with ${{ secrets.API_KEY }}

Update your .env file with this key.

Add .env to .gitignore

about 4 years ago · Juan Pablo Isaza Relatório
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