mirror of
https://github.com/wassname/chatGPTBox.git
synced 2026-06-29 13:47:56 +08:00
chore: send cookie when requesting chatgpt accesstoken
This commit is contained in:
@@ -41,7 +41,16 @@ async function getChatGptAccessToken() {
|
||||
if (userConfig.accessToken) {
|
||||
return userConfig.accessToken
|
||||
} else {
|
||||
const resp = await fetch('https://chat.openai.com/api/auth/session')
|
||||
const cookie = (await Browser.cookies.getAll({ url: 'https://chat.openai.com/' }))
|
||||
.map((cookie) => {
|
||||
return `${cookie.name}=${cookie.value}`
|
||||
})
|
||||
.join('; ')
|
||||
const resp = await fetch('https://chat.openai.com/api/auth/session', {
|
||||
headers: {
|
||||
Cookie: cookie,
|
||||
},
|
||||
})
|
||||
if (resp.status === 403) {
|
||||
throw new Error('CLOUDFLARE')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user