First, let me say that i am just learning the basics of backend using Cloudant. I need to develop an iOS app that allows the users to create an account and login into the app, but i am a little confuse with this process. I have read the Cloudant Authenticate Docs but it looks like that information is related to creating admin users to access the database, not the target users of the app. So i was thinking that what i have to do is:
Create a "createAccount" web service -> This web service will create a document in my Cloudant database. I would use a "type" field in the document and set it to "user" (Because in Cloudant i can not have collections, so one way to differentiate types of documents is by adding a "type" field).
Create a "login" web service -> I would need to do some logic here to authenticate the user and return a cookie for future use in all the web services.
So basically my questions are:
- Is this a valid way to create users documents in Cloudant?
- If not, what could you recommend me?
- How can i define that some documents (for example, a document that represents a post) should only be modified by a certain user? Maybe having some info about the user inside the post document?
- Will the Authenticate APIs that Cloudant has built-in work for this case?
Thanks a lot for your help!