I'm creating a web app (a simple shopping list) using PouchDB and Cloudant.
Every new user will have the possibility to create his own "account" (every user will have a DB in my cloudant account) and every user will save his own shopping list, data, etc.
So, the question is: Is there a way to hide or protect the Cloudant credentials to access the main database with wich every user will interact?
To create a db in pouchDB the syntax is:
var remoteDB = ('https://myDB.cloudant.com/myMainDB', {
auth: {
username: "myUsername",
password: "myPassword"
});
Since this data is placed inside a .js file every one over the internet can access. Or maybe I'm wrong and PouchDB isn't designed for this purpose. Thanks to all! :)
One way would be to read in the username and password from environment variables: