Skip to content

Commit

Permalink
mansar.io
Browse files Browse the repository at this point in the history
  • Loading branch information
MuneebAnsari committed Apr 12, 2024
1 parent 558af7b commit a9e1325
Show file tree
Hide file tree
Showing 653 changed files with 75,067 additions and 3 deletions.
2 changes: 1 addition & 1 deletion verifyemail/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
const payloadEncoded = btoa(JSON.stringify(payload)).replace(/=/g, "");
console.log(payloadEncoded);
// const signature = btoa(headerEncoded + "." + payloadEncoded);
return headerEncoded + "." + payloadEncoded + "." + btoa(secret);
return headerEncoded + "." + payloadEncoded + "." + secret;
}

let decodedPayload = decodeJwt(receivedToken);
Expand Down
25 changes: 25 additions & 0 deletions verifyemail/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const jwt = require("jsonwebtoken");
const express = require("express");
const app = express();

app.get("/token", (req, res) => {
const token = req.query.token;
const secret =
"acec655005ad1288027db5d9cf1d232795b11894d8750aaa11e5b11102fa38f9";

try {
const decodedPayload = jwt.verify(token, secret);
const updatedPayload = { ...decodedPayload, status: "abc" };

const updatedToken = jwt.sign(updatedPayload, secret);
res.send({ original: token, updated: updatedToken });
} catch (err) {
// Token verification failed
console.error("Token verification failed:", err.message);
res.status(401).send("Unauthorized");
}
});

app.listen(5000, () => {
console.log(`Example app listening on port ${5000}`);
});
12 changes: 12 additions & 0 deletions verifyemail/node_modules/.bin/mime

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions verifyemail/node_modules/.bin/mime.cmd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions verifyemail/node_modules/.bin/mime.ps1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions verifyemail/node_modules/.bin/semver

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions verifyemail/node_modules/.bin/semver.cmd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions verifyemail/node_modules/.bin/semver.ps1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a9e1325

Please sign in to comment.