I am building a Web App and a separate API (so that users can share their collected data with someone if they want to) using Ruby on Rails. The users can log in on the web a
Rails uses sessions to keep track of the state of a user, which is stored in the user's cookies.
The documentation for sessions can be found here
If you leverage an authentication system such as Devise, you will have access to a current_user method in your controllers as well as a ton of different helpers which you can leverage, depending on your specific needs