lucia-auth / lucia

Authentication, simple and clean
https://lucia-auth.com
MIT License
8.42k stars 449 forks source link

Password hash string missing field #1488

Closed a-barbieri closed 3 months ago

a-barbieri commented 3 months ago

I'm using Astro 4.5.2 and Lucia 3.1.1 with Oslo 1.1.3.

Apparently the following line generates an password hash string missing field error:

https://github.com/lucia-auth/lucia/blob/bc25c1cce0590b36b6692ac497395250c9cefdbb/docs/pages/tutorials/username-and-password/astro.md?plain=1#L207

To fix it I followed the suggestion provided by Oslo here: https://github.com/pilcrowOnPaper/oslo/blob/8ad3f5017c54110eed041dd512f50807d74c708d/docs/pages/reference/password/Argon2id/index.md

    const argon2id = new Argon2id();
    const hash = await argon2id.hash(existingUser.password);
    const validPassword = await argon2id.verify(hash, password);
a-barbieri commented 3 months ago

After reading more carefully the code, I think this error is due to the fact that I create my test user directly in Postgres using a INSERT command.

Creating it through the application the password is hash with the following line: https://github.com/lucia-auth/lucia/blob/bc25c1cce0590b36b6692ac497395250c9cefdbb/docs/pages/guides/email-and-password/basics.md?plain=1#L82