fix(admin-verification): attach bearer token to verification queue/detail fetches
All checks were successful
build-and-release / build (push) Successful in 1m1s

Backend's AuthUser extractor only reads the Authorization header — it never
looks at cookies. The verification queue list (index.tsx load()) and every
call in the verification detail page (via the shared adminFetch helper) sent
credentials: 'include' but no Authorization header, so they 401'd right after
a successful login even though the access token was already in sessionStorage.
Matches the pattern already used by the approve/reject actions further down
in index.tsx.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Ashwin Kumar Sivakumar 2026-07-18 22:59:04 +05:30
parent d1db169162
commit fe9c994b74
2 changed files with 15 additions and 2 deletions

View file

@ -3,10 +3,17 @@ import { For, Show, createMemo, createSignal, onMount } from 'solid-js';
const API = '';
async function adminFetch(path: string, opts?: RequestInit) {
const accessToken = typeof sessionStorage !== 'undefined'
? sessionStorage.getItem('nxtgauge_admin_access_token') || ''
: '';
return fetch(`${API}${path}`, {
...opts,
credentials: 'include',
headers: { 'Content-Type': 'application/json', ...(opts?.headers ?? {}) },
headers: {
'Content-Type': 'application/json',
...(accessToken ? { Authorization: `Bearer ${accessToken}` } : {}),
...(opts?.headers ?? {}),
},
});
}

View file

@ -157,8 +157,14 @@ export default function VerificationManagementPage() {
const load = async () => {
try {
setError('');
const accessToken = typeof sessionStorage !== 'undefined'
? sessionStorage.getItem('nxtgauge_admin_access_token') || ''
: '';
const res = await fetch(`${API}/api/admin/verifications?page=1&limit=200`, {
headers: { Accept: 'application/json' },
headers: {
Accept: 'application/json',
...(accessToken ? { Authorization: `Bearer ${accessToken}` } : {}),
},
credentials: 'include',
});
if (!res.ok) throw new Error(`Failed to load verification queue (${res.status})`);