Search code examples
javarestheart

should I authenticate with every call to RESTHeart?


I want to write a messenger app on Swift, iOS and as a database I chose MongoDB and turned ON authentication on it. And for the bridge I chose RESTHeart(GitHub). But for input something to database from RESTHeart I use the next line:

http PUT 127.0.0.1:8080/myfirstdb desc='this is my first db created with restheart' -a username:password

So, I use authentication for each connection. So my question is:

Is it OK, log in for each insert to database for the messenger app or there are another, better, solution? I think that I need to make this process as faster as possible


Solution

  • Quoting the RESTHeart documentation:

    If a request is successfully authenticated, an authentication token is generated and included in every subsequent responses. Following requests can either use the password or the auth token.

    http://restheart.org/docs/security.html

    You have to enable the auth token with the auth-token-enabled: true configuration