We are considering to use Backendless for our websites/HTML5 mobile apps.
I read in the docs that I have to call the Backendless init function first, in order to make API calls towards Backendless (Javascript API):
Backendless.initApp( application-Id, secret-key, version )
As far as I know, this function should be put in a certain javascript file/HTML file. Since the source code of web apps are visible for everyone (via browsers/inspector), I was wondering how safe it actually is to put our secret key in a public file.
Is this secure ?
Is there any solution to call the init function in a secure way, so that our secret key/application ID is not exposed to the public ?
Secret key is not that “secret”. A better name for it is “API Key”. Securing your backend data is not about keeping the key hidden, but more of a task of configuring a security policy on the backend by assigning proper permissions to users and roles. I recommend watching the “Backendless Security” webinar where I talked about many of these topics: https://backendless.com/webinars
Is this answer still relevant? I’m asking because I have the same questions, but I notice that this is a 9-year-old answer. Also, I didn’t see that webinar when I followed your link.
I’m halfway through the webinar, and I think I grasp it now. So, to summarize:
You don’t use private and public API keys. This is because that model of security is kind of arbitrary, like keeping a secret for the sake of keeping a secret. Keys don’t make your app secure—policies do.
Instead, you rely solely on permission-based security settings for data, based on
global permissions,
authentication,
and roles
Backendless defaults to very liberal security settings for data, so developers need to actively secure their apps by going through the settings for each table.
That’s a good summary. Additionally, every app in Backendless gets a dedicated subdomain in the form of xxxxx.backendless.app. When you use that domain for the API calls, your App ID and API key are not referenced in the URLs at all.
Yes, in the Domain Control section you can map an API Key to the domain. When a request is received by Backendless, the platform will use the security permissions associated with the specified key.