File tree 1 file changed +8
-1
lines changed
1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,9 @@ $ npm install jsonwebtoken
13
13
14
14
# Usage
15
15
16
- ### jwt.sign(payload, secretOrPrivateKey, options)
16
+ ### jwt.sign(payload, secretOrPrivateKey, options, [ callback] )
17
+
18
+ (Asynchronous) If a callback is supplied, callback is called with the JsonWebToken string
17
19
18
20
(Synchronous) Returns the JsonWebToken as string
19
21
@@ -51,6 +53,11 @@ var token = jwt.sign({ foo: 'bar' }, 'shhhhh');
51
53
// sign with RSA SHA256
52
54
var cert = fs .readFileSync (' private.key' ); // get private key
53
55
var token = jwt .sign ({ foo: ' bar' }, cert, { algorithm: ' RS256' });
56
+
57
+ // sign asynchronously
58
+ jwt .sign ({ foo: ' bar' }, cert, { algorithm: ' RS256' }, function (token ) {
59
+ console .log (token);
60
+ });
54
61
```
55
62
56
63
### jwt.verify(token, secretOrPublicKey, [ options, callback] )
You can’t perform that action at this time.
0 commit comments