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

Quourtige's avatar

Do I need to use Laravel Sanctum or Laravel Passport to communicate with Apache Kafka or there is no need

Hello everybody,

I have a project in which I separated the front-end (Vuejs) and the backend (Laravel API).

I will use Apache Kafka to get data from IoT devices then Laravel will use this data (Consume) to display analytics in real-time to the front-end.

I decided to not use microservices for many reasons (we're just 2 in the team without any experience in micro-services and we need to validate the business value first).

After this, I decided to use Laravel Sanctum (SPA authentication) to implement the authorization part, easy and perfect for my use case per the documentation but then I remembered that I also need Apache Kafka to communicate with Laravel API.

I have read the documentation for both the Laravel Sanctum and Laravel Passport and it said "Laravel Sanctum does not support OAuth2".

I'm confused here do I need to use Authorization for Apache Kafka for my Laravel API to consume data from it in the first place or not? and if yes do I need to use Laravel Passport?

I forget to mention that I decided to use another RDBMS(MySql) for tables after much deliberation and Apache Kafka for just the data coming from IoT.

0 likes
2 replies
Quourtige's avatar

Yes, I saw this article and it's the reason why I asked this question because it seems that using OAuth2 here is optional for more security (if you're consuming data from a system outside the Laravel API).

But it looks like because I'm using API to Produce/Consume then this step is necessary.

I will look for more details and probably just use Laravel Passport.

Thank you :)

Please or to participate in this conversation.