* Returns a token that allows only read operations * * @method getReadOnlyToken * @memberof StreamClient.prototype * @param {string} feedSlug - The feed slug to get a read only token for * @param {string} userId - The user identifier * @return {string} token * @example client.ge
(feedSlug: string, userId: string)
| 464 | * @example client.getReadOnlyToken('user', '1'); |
| 465 | */ |
| 466 | getReadOnlyToken(feedSlug: string, userId: string) { |
| 467 | utils.validateFeedSlug(feedSlug); |
| 468 | utils.validateUserId(userId); |
| 469 | |
| 470 | return JWTScopeToken(this.apiSecret as string, '*', 'read', { |
| 471 | feedId: `${feedSlug}${userId}`, |
| 472 | expireTokens: this.expireTokens, |
| 473 | }); |
| 474 | } |
| 475 | |
| 476 | /** |
| 477 | * Returns a token that allows read and write operations |
no test coverage detected