Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

ashishgupta001's avatar

Implement REST API for Basic Auth in a Laravel 5.0 application

Hi, I had built a web application (medium size complexity) a few years back using Laravel 5.0 (I know it's dated now). I don't want to invest much time upgrading it to later version of Laravel as it serves my purpose in current form.

Lately I had a requirement to add some basic capabilities on mobile. For that I tried adding REST API using HTTP Basic Auth package itself. But not been successful. Whenever I call the "Auth\AuthController@doLogin" (having username and password in the body as JSON using POST method) I get 405 error. I tried a few things but with little success.

Wondering if someone can point as to what wrong I am doing here? Or is he is the right approach. I explored JWT option as well but seems it is not compatible with Laravel 5.0.

I want to avoid upgrading Laravel if possible.

Ash

0 likes
2 replies
jlrdw's avatar

It may be worth just porting the code with the tweaks needed, to a fresh laravel 5.5 or 5.7.

I changed over a 5.1 to a 5.5, and it only took about 3 evenings and after that a few smaller little tweaks.

Just my opinion. You probably could charge the customer for an upgrade, explaining to them it's probably better.

I wouldn't bother attempting an upgrade from so many versions back.

ashishgupta001's avatar

@JLRDW - Thanks @jlrdw for the quick response. As I mentioned I attempted to migrate to more recent version but given that much has changed (especially the file structure) I was a bit skeptical. I googled looking for resources to help migration but could not find much which will help address my concern.

Knowing that you have successfully migrated, it gives some confidence. I can give a try. If you have any resources or some sort of migration guide or your personal notes, please do share.

Much thanks for your help. Ash

Please or to participate in this conversation.