Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comments: DIY Authentication and Authorization in SvelteKit 1 with SQLite #85

Open
phartenfeller opened this issue Feb 8, 2023 · 4 comments

Comments

@phartenfeller
Copy link
Owner

Blogpost: https://hartenfeller.dev/blog/sveltekit-diy-authentication-authorization

Comments on this issue are displayed on the blogpost.

@zfranco55
Copy link

zfranco55 commented Aug 29, 2023

Some points are not clear to me:
how is it possible to renew the session (if I understood correctly, it expires after an hour) and auto-login after a certain period of inactivity of the application

@phartenfeller
Copy link
Owner Author

@zfranco55 I set the max session duration to 30 days. It just checks every hour if there are sessions that need to be killed.

function performLogin(cookies: Cookies, username: string) {
  const maxAge = 1000 * 60 * 60 * 24 * 30; // 30 days
  const sid = createSession(username, maxAge);
  cookies.set('sid', sid, { maxAge });
}

I didn't implement any session renewal. After 30 days you would have to log in again.

@Polihronos
Copy link

return bcrypt.compare(password, row.password); i am getting that Property 'password' does not exist on type '{}'.ts(2339)
and on the error messages i am getting : Property 'errorMessage' does not exist on type '{}'.ts(2339)
i am getting problem with the types and you don't seem to have any of the kind. Can you help me understand what might've gone wrong

@phartenfeller
Copy link
Owner Author

@Polihronos Looks like your row object is empty or does not exist. Did you name it differently?

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

No branches or pull requests

3 participants