Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions final_project/cookies.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Netscape HTTP Cookie File
# https://curl.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.

#HttpOnly_localhost FALSE / FALSE 0 connect.sid s%3A_BzWNjXs7fBYMkmBwA0Q4YyZc6_sNmkQ.UhYR6ZIhAPyITcw0CQamCdz%2B4akT00FuqyqykIALq7s
16 changes: 15 additions & 1 deletion final_project/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,23 @@ app.use("/customer",session({secret:"fingerprint_customer",resave: true, saveUni

app.use("/customer/auth/*", function auth(req,res,next){
//Write the authenication mechanism here
if(req.session.authorization) {
token = req.session.authorization['accessToken']; // Access Token
jwt.verify(token, "access", (err, user) => {
if(!err){
req.user = user;
next(); // Proceed to the next middleware
}
else{
return res.status(403).json({message: "User not authenticated"})
}
});
} else {
return res.status(403).json({message: "User not logged in"})
}
});

const PORT =5000;
const PORT =3000;

app.use("/customer", customer_routes);
app.use("/", genl_routes);
Expand Down
Loading