csrf-auth-debugger

Debug CSRF and JWT authentication issues in Django projects.

Updated Sep 22, 2025
One-click install
npx skills add https://github.com/allthriveai/allthriveai --skill csrf-auth-debugger
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: csrf-auth-debugger
Source: https://github.com/allthriveai/allthriveai/tree/main/.claude/skills/csrf-auth-debugger
Command: npx skills add https://github.com/allthriveai/allthriveai --skill csrf-auth-debugger

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you diagnose CSRF verification failures, authentication problems, and OAuth flow issues across your Django/DRF setup.

Core Features & Use Cases

  • CSRF Cookie & Header Verification: Ensure csrftoken cookie and X-CSRFToken header alignment.
  • JWT & OAuth Flow Checks: Validate access/refresh tokens and OAuth callback steps.
  • Cookie & CORS Configuration: Inspect cookie flags, domain, and trusted origins.
  • Login & Token Refresh Troubleshooting: Reproduce and fix login or token refresh problems.

Quick Start

Request the CSRF token endpoint to set the cookie, then attempt a login or write operation, verifying cookies and headers are correctly sent and accepted.

Frequently Asked Questions about csrf-auth-debugger

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I debug CSRF token verification failures in Django?

CSRF token verification failures occur when the csrftoken cookie and X-CSRFToken header don't align. Verify the token endpoint sets the cookie, confirm your frontend sends the header with each POST/PUT/DELETE request, and check that cookie domain, path, and SameSite policies match your CORS configuration.

Why am I getting 403 Forbidden errors on POST requests with JWT authentication?

403 errors typically indicate CSRF validation failed or the JWT token wasn't sent correctly. Verify httpOnly cookies contain the JWT, the X-CSRFToken header is present, Django CSRF middleware is enabled, and your Axios requests include credentials and the CSRF token from the cookie.

How do I troubleshoot OAuth callback errors in Django with JWT tokens?

OAuth callback errors stem from token refresh failures, misaligned redirect URIs, or missing environment configuration. Check django-allauth settings, validate the access and refresh token exchange, inspect callback URL configuration, and verify your token service endpoint is accessible and returning valid JWTs.

What's the correct way to set up httpOnly cookies with CSRF protection for Axios requests?

Set httpOnly, Secure, and SameSite flags on CSRF and JWT cookies to prevent XSS attacks and cross-site requests. Configure Axios to send credentials with each request, extract and include the csrftoken in the X-CSRFToken header, and align your CORS trusted origins with your frontend domain.

Can I use JWT tokens stored in httpOnly cookies with Django REST Framework?

Yes. Django REST Framework supports JWT authentication with httpOnly cookies. Configure your token service to issue JWTs in httpOnly cookies, set up django-allauth for OAuth flows, enable CSRF middleware, and ensure your frontend sends the X-CSRFToken header on state-changing requests.

Why isn't my token refresh working with Django and Axios?

Token refresh fails when the refresh endpoint doesn't receive the JWT, CSRF validation rejects the request, or cookie attributes block transmission. Verify the refresh token is stored in an httpOnly cookie, Axios sends credentials, the X-CSRFToken header is included, and your Django token service is configured to accept both.