Analyzing Actions
In Chapter 4, we spent a section looking at how actions worked. Now, it’s time that we took a closer look at them and how they work under the hood. But before we begin, we’ll need to set up another fake database and briefly discuss security. Once we’ve done that, we’ll finish adding logic to our application and authenticate valid users. This section will cover the following:
- Database setup
- Passwords and security
- Login action
After all of this, you’ll have a general understanding of how to finally create a login form for your own SvelteKit application.
Database setup
Of course, this isn’t a real database. We’re going to utilize yet another JSON file that will store our user data and help us simulate looking up a user and their hashed password. It should look something like this:
src/lib/users.json
[ { "id": "1", ...