## 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.