Closed jlaksana closed 1 year ago
Azure Static Web Apps: Your stage site is ready! Visit it here: https://white-glacier-0bbe79d1e-65.westus2.2.azurestaticapps.net
Azure Static Web Apps: Your stage site is ready! Visit it here: https://white-glacier-0bbe79d1e-65.westus2.2.azurestaticapps.net
Azure Static Web Apps: Your stage site is ready! Visit it here: https://white-glacier-0bbe79d1e-65.westus2.2.azurestaticapps.net
Azure Static Web Apps: Your stage site is ready! Visit it here: https://white-glacier-0bbe79d1e-65.westus2.2.azurestaticapps.net
Azure Static Web Apps: Your stage site is ready! Visit it here: https://white-glacier-0bbe79d1e-65.westus2.2.azurestaticapps.net
Azure Static Web Apps: Your stage site is ready! Visit it here: https://white-glacier-0bbe79d1e-65.westus2.2.azurestaticapps.net
Implemented the login and signup routes using JWT and bcrypt. Login validates the user's username and password and responds with a token. Signup takes in all the user required fields, creates a user with those fields, and responds with a token. The token contains the user's id and username. I also implemented the middleware function to validate a token and applied it to all post and patch routes.
Routes added:
/auth/login
Takes username and password -> token/auth/signup
Takes username, password, first name, last name, and email -> creates the user and returns a tokenTo test the login route, use these users:
{"username": "JoeMama", "password": "ilovebananas"}
{"username": "joebaba", "password": "iloveoranges"}
then use the token, add it to the header, then call one of the protected routes.
For protected routes, add to the request header:
Authorization: Bearer {token}
Other notes:
authenticateUser
middleware functionTOKEN_SECRET
environment variable