Implement native username/password authentication
src
directory, create a hooks.server.ts
fileroutes
directory, create a route called login
. In your login +page.svelte
, create form elements for taking in username and password inputs. Create buttons for login and register.
registerValidate
and loginValidate
logout
endpoint.env
file (create if you haven’t done so) that takes in your database URI and user table nameAfter submitting the form, the user will be redirected to the endpoint of your choice.
Upon registering, the user will be added to the database with the username and a secure hashed password.
On login, the user will be authenticated through your database.
A browser cookie will be created as well as a session in local memory storage called “svault-auth”.
.env
file.Implement native username/password authentication
src
directory, create a hooks.server.ts
fileroutes
directory, create a route called login
. In your login +page.svelte
, create form elements for taking in username and password inputs. Create buttons for login and register.
registerValidate
and loginValidate
logout
endpoint.env
file (create if you haven’t done so) that takes in your database URI and user table nameAfter submitting the form, the user will be redirected to the endpoint of your choice.
Upon registering, the user will be added to the database with the username and a secure hashed password.
On login, the user will be authenticated through your database.
A browser cookie will be created as well as a session in local memory storage called “svault-auth”.
.env
file.