Skip to content

feat(api-client): attach CSRF token to unsafe requests - #122

Merged
anthonyA1214 merged 1 commit into
mainfrom
feat/api-client-csrf-token
Nov 29, 2026
Merged

anthonyA1214 merged 1 commit into
mainfrom
feat/api-client-csrf-token

Conversation

@anthonyA1214

Copy link
Copy Markdown
Member

Ticket

N/A

Description

Adds CSRF handling to the Axios request interceptor so state-changing requests send an X-CSRFToken header. When getCSRFToken returns nothing, the interceptor first calls /_allauth/browser/v1/config with credentials and reads the token again; safe methods (GET, HEAD, OPTIONS, TRACE) are intended to bypass this logic.

Related Issue

N/A

Type of Change

  • Bug fix
  • New feature
  • Chore
  • Refactor
  • Documentation

Image Change

N/A

Make the auth request interceptor async and set the X-CSRFToken header
using getCSRFToken. If no token is available yet, request the allauth
browser config endpoint first, then read the token again. GET, HEAD,
OPTIONS, and TRACE requests are meant to skip this step.
@anthonyA1214
anthonyA1214 merged commit fded6d1 into main Nov 29, 2026
7 checks passed
@anthonyA1214
anthonyA1214 deleted the feat/api-client-csrf-token branch November 29, 2026 21:37
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