Create L8 API - Not an SPA, No Passport needed, plain old API
I'm struggling to create an API with Laravel since Sanctum. I first want to mention my really simple requirements:
I'm not creating an SPA.
I'm not using Vuejs.
I don't want or need Passport. The overhead of OAth is not needed.
I don't want cookie based authentication
I simply want API tokens.
I will make add-hoc requests from the internet, for example, I might be using Postman for testing.
I don't session authentication, just "a simple API request and response".
In older versions (5.8 + 6.0 for example) I could simply create an api_token field on the users table and get cracking.
Not so much anymore. Now it seems Sanctum is the tool and the documentation quickly leads you into lots of complexity. What am I missing? Prior attempts at doing this worked fine for localhost but the moment I moved to Postman and the internet I had all kinds of authorization issues because it seems Laravel 8 is now expected lots of extra that I don't know what to add.
Thanks @bobbybouwmann I managed to get it working in the traditional way.
What's a bit blind is that entire old school way of doing it has been removed from the manual and doing it the Sanctum way seems impossible for simple APIs.
@eugenevdm I don’t think token-based authentication has gone away. I’m pretty sure—given that you have to install Sanctum—that the tokens guard is still the default, and you’re still able to use that guard if it suits your needs and purpose.
Yep I learnt that the hard way now. The Sanctum documentation talks about token based authentication but it quickly delves into creating tokens and showing them to the user and so on which is overkill for what I wanted to do. It seems that we are being directed towards creating SPA's or refreshing tokens and so on.
All I wanted to do was a simple API. What's gone away are the two places in the manual that explains how to do it the old way.