Skip to content

Adds authentication with JWT and cookies#13

Open
fterdal wants to merge 5 commits intomainfrom
add-auth
Open

Adds authentication with JWT and cookies#13
fterdal wants to merge 5 commits intomainfrom
add-auth

Conversation

@fterdal
Copy link
Contributor

@fterdal fterdal commented Jul 7, 2025

This PR adds four essential authentication routes:

  • auth/me
  • auth/signup
  • auth/login
  • auth/logout

It also adds a user model, with username and password fields.

len: [3, 20],
},
},
passwordHash: {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important Password Hashing

db.logging = false;
await db.sync({ force: true }); // Drop and recreate tables

const users = await User.bulkCreate([

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

helps create the passwords

{ expiresIn: "24h" }
);

// Set token as HTTP-only cookie

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this portion will allows us to set restrictions for our cookies to not be accessed, and given a age for the cookie to exist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants