D
D
deadkEEper12015-10-29 23:45:57
MongoDB
deadkEEper1, 2015-10-29 23:45:57

Registration and authorization?

Kind) I do not fully understand the processes of user authorization and session tracking. To whom it is not difficult to explain with an elementary example. Let's say you need to make a site where you can only register and be under your own name. If the user is not authorized, send to the registration/authorization page.
And so, registration takes place in a classic way, name and password - a new user is sent to the database (in my case, mongoDb) 1st stupid question, save the password in mongoDB?)
After registration, authorization should be possible. And here's where I don't know how to do it. Sessions, cookies... I've seen dalali with the express-session module. Tell me in simple terms how to do it? What is the first thing to understand? Thanks

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
amatory10, 2015-10-29
@amatory10

for example, after successful authorization, store information in localStorage in order to know that the user is still authorized, and after log out, delete information from localStorage.

E
Evgeny Petrov, 2015-10-30
@EvgenZZ

what do you write back-end on? on node or php, you can just write in php for example Silex or Lumen, Express js

Y
Yaroslav Lyzlov, 2015-10-30
@dixoNich

https://scotch.io/tutorials/authenticate-a-node-js...
This link describes the process very well. NodeJS + MongoDB (ORM mongoose)
Access-token on the client can be stored in localStorage. By access-token on the backend, you can find out which user is making the request. In general, everything is well written there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question