Skip to content

Laravel Sanctum: Login fails using Fetch API #42729

Answered by NK0D1NG
NK0D1NG asked this question in Q&A
Discussion options

You must be logged in to vote

Hey there,
I misinterpreted my error logs and found that there is another small difference using Axios and Fetch API:
Axios seems to decode the X-XSRF-TOKEN whereas Fetch API does not.

So this example token is sent by Fetch API:
eyJpdiI6IkRScW9GNGtIbndWWFdKbzRiN0VWVkE9PSIsInZhbHVlIjoiNUNuQStiZGt0Y3l0cXhReThHSEJxbCsxRmZvbFFHKzhQV3ArSlg0cjVQVm5qSDZoQ3ZsSERnUTREUXRvczdMOHhYSHFqbm5FUjd2dFpGMlN4bU81NWJ5SWpmem5BQi9vRmJBRFZZWmFSZFlqcHNxbTZ5N1Z0cGJzSmMwcUFRaXUiLCJtYWMiOiI4MjM1MTQ2ODExNzhlY2ExNDk1NDhhOWEwNzE0OWJlMzViOGQxNDJhMTY0YTI2NzYwMThjMzQ5ODVmMDYwMjk1IiwidGFnIjoiIn0%3D

And this example token is sent by Axios:
eyJpdiI6IisydDZOOFJoREp5ZnZudUtjRk1teXc9PSIsInZhbHVlIjoiV1dQdjJDZlNrcW43Zlg4TW1yRFdj…

Replies: 3 comments 6 replies

Comment options

You must be logged in to vote
1 reply
@NK0D1NG
Comment options

Comment options

You must be logged in to vote
2 replies
@NK0D1NG
Comment options

@danpastori
Comment options

Comment options

You must be logged in to vote
3 replies
@sarath-aj
Comment options

@imycroft
Comment options

@dogatonic
Comment options

Answer selected by NK0D1NG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
6 participants