How does Mongolab REST API authenticate

后端 未结 3 731
春和景丽
春和景丽 2021-02-07 23:52

The REST API for Mongolab is cool. I can use that for analytics in my website directly using the following javascript, provided on Mongolab\'s support page. Only if I can unders

相关标签:
3条回答
  • 2021-02-08 00:25

    I'd like to use MongoLab service for my first AngularJs app with MongoDB, but MongoLab is not ready for production with a web app that wants access from the front end to the MongoDB.

    It's very easy to get the API key in the browsers network traffic (see screenshot below, the apiKey is in plain text there) and then any one can have full access to the DB. So messing around with the MongoDB would be no problem.

    I haven't found a workaround for MongoLab yet. At the moment, I think I will use another service like https://www.dreamfactory.com/

    I haven't tried it in detail yet but it looks great for an AngularApp with MongoDB and I need to check how they implemented the security of the api. On the first look, it looks like it is working with session tokens to secure the requests to the database.

    Screenshot network traffic MongoLab credentials

    0 讨论(0)
  • 2021-02-08 00:31

    Excellent observation, and great question.

    Currently, all API keys have read and write access to the databases associated with the user's account, and any agent possessing an API key can successfully issue any such request.

    As you observe, this very basic pass key is not designed with any kind of fine-grained security in mind.

    However, we're working on a batch of new REST API security features aimed at precisely that.

    Contact us at support@mongolab.com if you'd be interested in discussing the details.

    0 讨论(0)
  • 2021-02-08 00:42

    You have an API key for doing http request to your DB using their REST API. For example, if a user wants to log in I make a request with a GET method like this:

    https://api.mongolab.com/api/1/databases/name_db/collections/users/put_your_params_like_username_and_pw?apiKey=xxxxxxxxx

    And then you analyze the response to that request. It is not the most secure DB in the world but it is getting better.

    If you want more info I talk about that in my blog: http://lolapriego.com/blog/?p=16

    0 讨论(0)
提交回复
热议问题