Guided project for Node Auth 1 Module.
- SQLite Studio installed.
- fork and clone this repository.
- CD into the folder where you cloned your fork.
- type
npm i
to download dependencies. - type
npm run server
to start the API.
Please follow along as the instructor adds authentication to the API.
- for password storage, use hashing. (use hashing because encryption is two-way), but hashing is one way. Once hashed, there is no (easy) way of getting the original string back (passowrd).
- register an account.
- login.
- log out.
- restrict access to resources.
- the server does not store info, the info is stored on the token. There is nothing to destroy
- on successeful login/register, produce and send a token
- send token to the client
- on following requests, verify the token
- if token is good, provide access, if not block access.
- store the tooken (memory, local storage, header .....)
- send the token on every request
- destroy the token on logout