From bb41549c6f8c30fc64d5c2c414b6d2ee190e1304 Mon Sep 17 00:00:00 2001 From: Eldritch Garden Date: Tue, 14 Oct 2025 11:47:48 -0400 Subject: [PATCH] fix(route/artstation): csrf token (#20290) * fix csrfToken * use cookie header to ensure we get private csrf token --- lib/routes/artstation/user.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/routes/artstation/user.ts b/lib/routes/artstation/user.ts index 29cb6c8fe..403bfac2b 100644 --- a/lib/routes/artstation/user.ts +++ b/lib/routes/artstation/user.ts @@ -2,6 +2,7 @@ import { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import path from 'node:path'; import { art } from '@/utils/render'; @@ -41,10 +42,11 @@ async function handler(ctx) { }; const csrfToken = await cache.tryGet('artstation:csrfToken', async () => { - const tokenResponse = await got.post('https://www.artstation.com/api/v2/csrf_protection/token.json', { + const tokenResponse = await ofetch.raw('https://www.artstation.com/api/v2/csrf_protection/token.json', { + method: 'POST', headers, }); - return tokenResponse.headers['set-cookie'][0].split(';')[0].split('=')[1]; + return tokenResponse.headers.getSetCookie()[0].split(';')[0].split('=')[1]; }); const { data: userData } = await got(`https://www.artstation.com/users/${handle}/quick.json`, {