Do I need to use OAuth2 to authorize my Laravel API to communicate with Apache Kafka?

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’m confused here do I need to use Authorization for Apache Kafka for just my Laravel API to consume data from it in the first place or not? and if yes do I need to use Laravel Passport?

NOTE: Apache Kafka will give data only to my Laravel API, so do I need to implement some OAuth2 here or not?

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

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

I hope that I have explained well my problem and where I’m really confused.

I don’t want to use Laravel Sanctum and when I get to the part where I need to consume data from Apache Kafka then I will be shocked to find that I need to use Laravel Passport (for OAuth2).

I don’t think I need to implement any Oauth2 here because there is no third-party app but I still need to be sure about it as I don’t have much knowledge about Kafka.

Source: Laravel

Leave a Reply