Skip to content

Commit dc151d1

Browse files
committed
Angular Security course
1 parent 97f4308 commit dc151d1

File tree

3 files changed

+104
-5
lines changed

3 files changed

+104
-5
lines changed

demos/jwt-hs256.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,21 @@
11

2-
console.log("JWT example");
2+
console.log(" JWT example using HMAC SHA256");
3+
4+
var jwt = require('jsonwebtoken');
5+
6+
7+
8+
var secretKey = 'secret-key';
9+
10+
var payload = {
11+
email: 'test@mailinator.com'
12+
};
13+
14+
15+
var token = jwt.sign(payload, secretKey, {algorithm: 'HS256' });
16+
17+
18+
console.log(token);
19+
20+
21+

package-lock.json

Lines changed: 83 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"command-line-args": "^4.0.6",
3939
"cookie-parser": "^1.4.3",
4040
"core-js": "^2.4.1",
41+
"jsonwebtoken": "^7.4.2",
4142
"moment": "^2.18.1",
4243
"nodemon": "^1.11.0",
4344
"password-validator": "^4.0.0",

0 commit comments

Comments
 (0)