Skip to content

Commit cc11e3e

Browse files
fix: adding clerk auth to header
1 parent 8513353 commit cc11e3e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

templates/vue/vue3-ai-chatbot-widget/src/core/azion-copilot.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,10 @@ export class AzionCopilot {
175175
headers['Authorization'] = `Bearer ${this.authToken}`
176176
}
177177

178+
if (this.authMode === 'clerk') {
179+
headers['Authorization'] = `Bearer ${document.cookie.split('__session=')[1]?.split(';')[0]}`
180+
}
181+
178182
const response = await fetch(`${this.serverConfig.url}${this.serverConfig.conversation}`, {
179183
method: 'POST',
180184
credentials: shouldIncludeCredentials ? 'include' : 'omit',
@@ -285,6 +289,10 @@ export class AzionCopilot {
285289
headers['Authorization'] = `Bearer ${this.authToken}`
286290
}
287291

292+
if (this.authMode === 'clerk') {
293+
headers['Authorization'] = `Bearer ${document.cookie.split('__session=')[1]?.split(';')[0]}`
294+
}
295+
288296
const response = await fetch(`${this.serverConfig.url}${this.serverConfig.feedback}`, {
289297
method: 'POST',
290298
credentials: shouldIncludeCredentials ? 'include' : 'omit',
@@ -370,4 +378,4 @@ export class AzionCopilot {
370378
setAuthToken(token) {
371379
this.authToken = token
372380
}
373-
}
381+
}

0 commit comments

Comments
 (0)