MCPcopy Create free account
hub / github.com/GetStream/stream-js / getReadOnlyToken

Method getReadOnlyToken

src/client.ts:466–474  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

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

Callers 3

beforeEachNodeFunction · 0.80
test.tsFile · 0.80
token_test.jsFile · 0.80

Calls 1

JWTScopeTokenFunction · 0.90

Tested by

no test coverage detected