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

Method getReadWriteToken

src/client.ts:486–494  ·  view source on GitHub ↗

* Returns a token that allows read and write operations * * @method getReadWriteToken * @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 cli

(feedSlug: string, userId: string)

Source from the content-addressed store, hash-verified

484 * @example client.getReadWriteToken('user', '1');
485 */
486 getReadWriteToken(feedSlug: string, userId: string) {
487 utils.validateFeedSlug(feedSlug);
488 utils.validateUserId(userId);
489
490 return JWTScopeToken(this.apiSecret as string, '*', '*', {
491 feedId: `${feedSlug}${userId}`,
492 expireTokens: this.expireTokens,
493 });
494 }
495
496 /**
497 * Returns a feed object for the given feed id and token

Callers 2

test.tsFile · 0.80
token_test.jsFile · 0.80

Calls 1

JWTScopeTokenFunction · 0.90

Tested by

no test coverage detected