Skip to content

Commit f52bbdf

Browse files
Merge pull request #47 from dcs-soni/fix/docs-authentication
docs: fixes in authentication code
2 parents f26c7cb + ee6ed16 commit f52bbdf

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/docs/src/content/docs/guides/authentication.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ To keep sessions alive, refresh the token just before its expiration and reconne
2828
```jsx
2929
const { control } = useChatKit({
3030
api: {
31-
getClientSecret(currentClientSecret) {
31+
async getClientSecret(currentClientSecret) {
3232
if (!currentClientSecret) {
3333
const res = await fetch('/api/chatkit/start', { method: 'POST' })
3434
const {client_secret} = await res.json();
3535
return client_secret
3636
}
3737
const res = await fetch('/api/chatkit/refresh', {
3838
method: 'POST',
39-
body: JSON.stringify({ currentClientSecret })
39+
body: JSON.stringify({ currentClientSecret }),
4040
headers: {
4141
'Content-Type': 'application/json',
4242
},
@@ -57,15 +57,15 @@ To keep sessions alive, refresh the token just before its expiration and reconne
5757

5858
chatkit.setOptions({
5959
api: {
60-
getClientSecret(currentClientSecret) {
60+
async getClientSecret(currentClientSecret) {
6161
if (!currentClientSecret) {
6262
const res = await fetch('/api/chatkit/start', { method: 'POST' })
6363
const {client_secret} = await res.json();
6464
return client_secret
6565
}
6666
const res = await fetch('/api/chatkit/refresh', {
6767
method: 'POST',
68-
body: JSON.stringify({ currentClientSecret })
68+
body: JSON.stringify({ currentClientSecret }),
6969
headers: {
7070
'Content-Type': 'application/json',
7171
},

0 commit comments

Comments
 (0)