Switching from Sanctum to JWT
I’ve been debugging for days to get my Ionic app working with the Laravel API backend.
The issue: logging in worked fine, but every subsequent API request failed with a 401.
The reason (I guess): the Ionic/capacitor app works with a referrer of
capacitor://localhost. I think this messes up the cookie that is set to maintain the session.
So I had to switch over to something without cookies. Having already spend days on the issues, I went to work with JWT as I’ve done so before.
I followed this tutorial to get me a head-start: https://www.positronx.io/laravel-jwt-authentication-tutorial-user-login-signup-api/