Answer the question
In order to leave comments, you need to log in
How to implement user authorization?
I understand rails and, accordingly, write an application.
I chose the oauth2 protocol as the authorization method, therefore I store a minimum of information about the user, namely: name, oauth provider identifiers (for example, vk.com user id) and avatar, and service ones, such as user_id and timestamps. If the user is already in my database, a new user is not created, it is immediately redirected to the profile.
How to determine at the backend level whether the user is logged in? I believe that it is necessary to create (or update the default created) a cookie with a session ID in order to determine whether there is a login or not, and also to bind this session to a specific user and pass this data between requests. Here I am, firstly, I'm not sure if I'm right, and secondly, if I'm right, how exactly should this be implemented? The first thing that comes to mind is the storage of user_id and session_id in the database, but with each client request, checking into the database seems like a waste of resources to me.
Answer the question
In order to leave comments, you need to log in
If you want your bike, then here is the guide:
www.sitepoint.com/rails-userpassword-authenticatio...
www.sitepoint.com/rails-userpassword-authenticatio...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question