Skip to content
This repository was archived by the owner on May 11, 2026. It is now read-only.

fix: use session auth for admin APIs#39

Open
nickita-khylkouski wants to merge 1 commit into
Safvan-tsy:mainfrom
nickita-khylkouski:codex/fix-admin-edit-auth
Open

fix: use session auth for admin APIs#39
nickita-khylkouski wants to merge 1 commit into
Safvan-tsy:mainfrom
nickita-khylkouski:codex/fix-admin-edit-auth

Conversation

@nickita-khylkouski
Copy link
Copy Markdown

Summary

  • replace the custom admin API Authorization-header gate with NextAuth server session validation
  • keep page-level admin protection in middleware without blocking session-authenticated API calls
  • reuse the authenticated user lookup across admin profile and post routes

Verification

  • npm run lint -- --file lib/admin-auth.ts --file middleware.ts --file app/api/admin/route.ts --file app/api/admin/post/route.ts --file 'app/api/admin/post/[id]/route.ts'
  • npx tsc --noEmit
  • npm run build

Closes #31

@vercel
Copy link
Copy Markdown

vercel Bot commented May 11, 2026

@nickita-khylkouski is attempting to deploy a commit to the safvantsy's projects Team on Vercel.

A member of the Team first needs to authorize it.

@nickita-khylkouski
Copy link
Copy Markdown
Author

Local verification passed:

  • npm run lint -- --file lib/admin-auth.ts --file middleware.ts --file app/api/admin/route.ts --file app/api/admin/post/route.ts --file 'app/api/admin/post/[id]/route.ts'
  • npx tsc --noEmit
  • npm run build

The Vercel check is blocked by fork deployment authorization, not by the build.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to properly edit from the editor

1 participant