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

dt84's avatar
Level 1

L5.4 Basic HTTP Authentication with headers

Hi,

I need to migrate an existing API to a new Laravel 5.4 application. The API uses HTTP basic authentication to authenticate users - by accepting the Authorization header with the value of Basic where the is a combination of username:password base64 encoded.

I tried to implement it by following L5.4 documentation (which is a bit cryptic about the subject), but all I could find refers to accepting the api_token URL parameter.

How should I define the middleware & guard for such an API? Isn't it supported by L5.4 out of the box? Please keep in mind that changing the authentication method is not an option.

Thanks a lot

0 likes
2 replies
dangerwayne's avatar

Hi! Did you ever figure this out? I need to figure this out as well.

Please or to participate in this conversation.