You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Regular users require a valid JWT token to access the Stream API. Tokens can't be created securely on the client-side, so you should generate tokens on your server-side. All important information about [tokens can be found in the client documentation](https://getstream.io/chat/docs/javascript/tokens_and_authentication/?language=javascript).
35
+
Regular users (all users except guests and anonymous users) require a valid JWT token to access the Stream API. Tokens can't be created securely on the client-side, so you should generate tokens on your server-side. All important information about [tokens can be found in the client documentation](https://getstream.io/chat/docs/javascript/tokens_and_authentication/?language=javascript).
36
36
37
37
Here is how you can provide the generated token to the Angular SDK:
38
38
39
39
```ts
40
40
// Option 1: using a static token
41
41
this.chatService.init(
42
42
"<API key>",
43
-
{
44
-
id: "<user id>",
45
-
name: "Sara",
46
-
image: "url/to/image",
47
-
},
43
+
"<user or id>",
48
44
// Example static token
49
45
"eyJhbGcIOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
50
46
);
51
47
52
48
// Option 2. using a token provider
53
49
this.chatService.init(
54
50
"<API key>",
55
-
{
56
-
id: "<user id>",
57
-
name: "Sara",
58
-
image: "url/to/image",
59
-
},
51
+
"<user or id>",
60
52
// Example token provider
61
53
// The SDK will call your token provider when you connect, or when the token is expired and it needs a new one
62
54
// With token providers you can use short-living tokens, so we advise using this method in your production applications
This is how you can use [developer tokens](https://getstream.io/chat/docs/javascript/tokens_and_authentication/?language=javascript#developer-tokens) with the Angular SDK:
0 commit comments