JSON Web Token for wingbot
npm install wingbot-jwtFast solution for webview requests authorization
``javascript
const { Processor } = require('wingbot');
const { BotTokenStorage } = require('wingbot-jwt');
const processor = new Processor(bot, {
tokenStorage: new BotTokenStorage('
})
``
-----------------
Storage for JWT tokens
ObjectKind: global class
* BotTokenStorage
* [new BotTokenStorage(secretOrPrivateKey, [jwtOptions])](#new_BotTokenStorage_new)
* .findByToken(token) ⇒ Promise.<(Token\|null)>
* .getOrCreateToken(senderId, pageId) ⇒ Promise.<(Token\|null)>
| Param | Type |
| --- | --- |
| secretOrPrivateKey | string \| Buffer |
| [jwtOptions] | Object |
BotTokenStorage | Param | Type |
| --- | --- |
| token | string |
BotTokenStorage | Param | Type |
| --- | --- |
| senderId | string |
| pageId | string |
Object| Name | Type |
| --- | --- |
| senderId | string |
| pageId | string |
| token | string |