Skip to content

Fix admin redirect by using authenticated server admin checks#43

Merged
prazgaitis merged 1 commit intomainfrom
fix/admin-server-auth-query-context
Feb 17, 2026
Merged

Fix admin redirect by using authenticated server admin checks#43
prazgaitis merged 1 commit intomainfrom
fix/admin-server-auth-query-context

Conversation

@prazgaitis
Copy link
Copy Markdown
Owner

@prazgaitis prazgaitis commented Feb 17, 2026

Summary

Follow-up to #42.

This fixes admin redirects caused by server-rendered admin checks using unauthenticated Convex queries.

Root Cause

Admin pages called isUserChallengeAdmin through ConvexHttpClient.query(...) in server components. That request had no auth token, so ctx.auth.getUserIdentity() was null and the query returned isAdmin: false, causing redirects.

Changes

  • Use authenticated fetchAuthQuery(...) for admin status checks in:
    • apps/web/app/challenges/[id]/admin/layout.tsx
    • apps/web/app/challenges/[id]/admin/activity-types/page.tsx
    • apps/web/app/challenges/[id]/admin/integrations/page.tsx
    • apps/web/app/challenges/[id]/admin/flagged-activities/page.tsx
    • apps/web/app/challenges/[id]/admin/flagged-activities/[activityId]/page.tsx
  • Add explicit typing for the admin status result.
  • Include generated API type update: packages/backend/_generated/api.d.ts.

Verification

  • pnpm -F web typecheck
  • precommit checks passed (turbo lint typecheck --affected)

@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 17, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
march-fitness-2025 Ready Ready Preview, Comment Feb 17, 2026 4:45pm

Request Review

@prazgaitis prazgaitis merged commit 4a27a5e into main Feb 17, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant