Noah Kruger
Noah Kruger

Reputation: 11

Should i use backend for simple API calls?

let's say i want to call an API from my frontend application in something like react. The API that i want to call is an external API provided by someone else. The thing is, I need to specify the API-key in header, so should i just make the call using react or should I use something like Spring Boot to make my own API that will call the external API and then pass the data to my react app? How about API-key protection in just plain frontend apps?

Upvotes: 1

Views: 394

Answers (1)

Isuru Perera
Isuru Perera

Reputation: 371

A best practice would be not to share your API keys in public, otherwise any malicious party can use the API key on behalf of you. I think it would be better to configure your API keys in the back end, and access that back end from your front end app.

Upvotes: 4

Related Questions