Modify schema of login/register/password-reset etc. response
Opened this issue · 0 comments
FrazeColder commented
Hey there,
I have modified my backend and instead of just returning the token
when the login route is called my backend returns such a response:
{
"message": "You have been successfully logged in.",
"data": {
"user": {
"id": 4,
"username": "123",
"email": "123@123.de",
"products_count": 13,
"comments_count": 646,
"saved_products_count": 1,
},
"token": "104|Hd2TOnxPMTFcMdbN3MyLFsidmUGfiaety6ioBJkP4b6ae563"
}
}
This means my login token
cannot be retrieved by larafetch
just by response.token
. I need to change it to response.data.token
as the token
is part of the data
object.
But how do I do this? I cannot find a single line of code where you set the Laravel Sanctum auth token to the header of the user. I can only see lines which are about the XSRF-Token
.
I highly appreciate any kind of help!
Kind regards