buliding Vue SPA authentication with Laravel Sanctum and Fortify

54 Views Asked by At

When sending POST request to /sanctum/csrf-cookie, CSRF protection for the application will be initialized, During this request, Laravel will set an XSRF-TOKEN cookie containing the current CSRF token. This token should then be passed in an X-XSRF-TOKEN header on subsequent requests, I was thinking, if i go to devtools > storage > cookies, then i can grab that csrf cookie and then use it manually and gain access to the application without logging in, if so, then how is that any secure ? shouldn't SPA authentication also has a method to destroy or revoke this cookie, shouldn't doing POST request to fortify route /logout destroy or revoke the cookie and then generate new one on future logins? if no then what is even the point of logging out ?, also shouldn't fortify and sanctum provide a way to revoke the cookie in case of SPA authentication like they do in API Token Authentication and Mobile Application Authentication ?

0

There are 0 best solutions below