Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSRF Token Mismatch #6336

Closed
rcapulsuhay opened this issue Apr 1, 2024 · 4 comments
Closed

CSRF Token Mismatch #6336

rcapulsuhay opened this issue Apr 1, 2024 · 4 comments

Comments

@rcapulsuhay
Copy link

rcapulsuhay commented Apr 1, 2024

Describe the bug

When using v1.6.8, I'm encountering CSRF Token Mismatch in Laravel Sanctum. I saw from this forum
that axios must downgrade to v1.3.3 and now everything is working.

To Reproduce

No response

Code snippet

export const http = axios.create({
  withCredentials: true,
  baseURL: HOST,
})

Login code
await http.get(API.CSRF_TOKEN);
const res = await http.post(API.LOGIN, data);

Expected behavior

No response

Axios Version

1.6.8

Adapter Version

No response

Browser

any

Browser Version

latest

Node.js Version

21.7.1

OS

windows

Additional Library Versions

No response

Additional context/Screenshots

No response

@justindhillon
Copy link

If this is a regression in the code, it would be in this file:

https://github.com/axios/axios/blob/v1.x/lib/adapters/xhr.js

@justindhillon
Copy link

These are all the commits between v1.3.3 and v1.6.8:

bbb61e7
bc9af51
96ee232
3dc8369
dd465ab
cff9967

@rcapulsuhay
Copy link
Author

If this is a regression in the code, it would be in this file:

https://github.com/axios/axios/blob/v1.x/lib/adapters/xhr.js

i have added the withXSRFToken now it's working now, thank you

@justindhillon
Copy link

No worries! Any time @rcapulsuhay !

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

No branches or pull requests

2 participants