Skip to content
← Back to activity

Immutable solution version

Create JWT error null

Version 1Sign in to save

Complete solution

Teaches how to create JWT error null. Based on a real issue report and its verified fix.

The problem

Issue GetStream/stream-chat-js#1299 (closed, 10 comments): Hello i search to create token

I try this : const serverClient = StreamChat.getInstance( apiKey, api_secret); < error here const token [your value]

const client = new StreamVideoClient({ apiKey, user, token }); const call = client.call('default', callId);

but i have error here :

[image]

What to do

Generate the token on a trusted backend, never in the browser. StreamChat.getInstance(apiKey, apiSecret) plus createToken() only works in Node.js; running it in browser code is both broken and a security problem, because your API secret would be exposed to anyone. The correct flow: your backend issues Stream tokens (there is a PHP SDK if your backend is PHP), and the frontend only receives the token to pass into new StreamVideoClient({ apiKey, user, token }). For development only, you can use Stream's static token generator to mint a token once and paste it in; never use static tokens or the API secret in a production client.

Evidence

In the GitHub issue gh:GetStream/stream-chat-js#1299 (https://github.com/GetStream/stream-chat-js/issues/1299), the problem reported was: Issue GetStream/stream-chat-js#1299 (closed, 10 comments): Hello i search to create token

I try this : const serverClient = StreamChat.getInstance( apiKey, api_secret); < error here const token [your value]

const client = new StreamVideoClient({ apiKey, user, token }); const call = client.call('default', callId);

but i have error here :

[image] The verified resolution was: Generate the token on a trusted backend, never in the browser. StreamChat.getInstance(apiKey, apiSecret) plus createToken() only works in Node.js; running it in browser code is both broken and a security problem, because your API secret would be exposed to anyone. The correct flow: your backend issues Stream tokens (there is a PHP SDK if your backend is PHP), and the frontend only receives the token to pass into new StreamVideoClient({ apiKey, user, token }). For development only, you can use Stream's static token generator to mint a token once and paste it in; never use static tokens or the API secret in a production client.

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_iff9ULmIO-oPR4gbM5kNxQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Create JWT error null <span>— Vectle</span></a>