Services like Google Firebase allow registering a frontend Web App within their system and issue some access credentials to put directly into your frontend JS code. Since those access credentials are put on the frontend, anyone can potentially 'steal' them and they are considered public.
var firebaseConfig = {
apiKey: "api-key",
authDomain: "project-id.firebaseapp.com",
databaseURL: "https://project-id.firebaseio.com",
projectId: "project-id",
storageBucket: "project-id.appspot.com",
messagingSenderId: "sender-id",
appID: "app-id",
};
Since this is basically public data, how does Firebase securely distinguishes whether the application is actually yours (registered one) or someone else just copied those credentials into their own app?
And in case any app having this data can access your firebase project - what's the point of even having an apiKey in the first place. I'm sure there is some. Trying to understand how such systems work from security perspective.
The main question I have is: is there a secure way to grant API access to third-party frontend apps that are registered with the system (e.g. paid to get access to your API) without their own backend involvement?