We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.
Required fields*
13
1
I also use mongodb but it's pretty easy to manage if you save the session (accesstoken) using redis (use atomic operations). The apitoken is generated in the server when the user creates an account and sent it back to the user. Then, when the user wants to authenticate it must send username+password+apitoken (put them in the http body). Keep in mind that HTTP doesn't encrypt the body so the password and apitoken can be sniffed. Use HTTPS if this is a concern for you.
@TheBronx The apitoken has 2 use cases: 1) with an apitoken you can control the access of the users to your system and you can monitor and build statistics of each user. 2) It's an additional security measure, a "secondary" password.
Idea of the token - beside abusing it for tracking user activity - is, that a user ideally does not need any username and password for using an application: The token is the unique access key. This allows users to drop any key at any time affecting only the app but not the user account. For a webservice a token is quite unhandy - that's why an initial login for a session is the place where the user gets that token - for a "regular" client ab, an token is no problem: Enter it once and you'r almost done ;)
A tag is a keyword or label that categorizes your question with other, similar questions. Choose one or more (up to 5) tags that will help answerers to find and interpret your question.
complete the sentence: my question is about...
use tags that describe things or concepts that are essential, not incidental to your question
apitoken? is it a "secondary" password?