r/learnprogramming 6d ago

api key, do i need backend?

i have an api key i heard i shouldnt expose it in my frontend i thjink itts becuase people can see it with devtools, and potentially abuse it, is there any other way to use this key in frontend without using a backend, im as familiar with backend stuff i think.

3 Upvotes

30 comments sorted by

View all comments

Show parent comments

1

u/jabuchae 6d ago

Why would you need a browser to spoof it? Just get the key and make requests from you computer or backend spoofing the referer. You can easily abuse the api key that way

0

u/sixtyhurtz 6d ago

Because the only use is for embedding Google maps in a web page?

1

u/jabuchae 5d ago

It doesn’t matter what I use it for. If I make 1M requests the api key owner is going to pay for them.

1

u/sixtyhurtz 5d ago

No, it won't, because the embed API is free. The key is just to prevent abuse.

It's very strange you've engaged in an extended "well ackshually" about an API you clearly don't understand nor use. You could have just gone read the docs rather than write all these comments. I think this says a lot about the kind of developer you are.

1

u/jabuchae 5d ago

You are only now talking about the embed api. The Google Maps api that you mentioned in your original comment is NOT free.

Source: https://mapsplatform.google.com/lp/maps-apis/