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

Amyrosein's avatar

Auth Drivers in an Uber Clone app ( Api )

hello there, I'm new to Laravel and I am creating an Uber like app with Api and I have an issue with authenticating users.

I'm not using default Users table but three tables : Drivers, Passengers and Admins.

on localhost/api/drivers people can register with email and password.

now I don't know how to login and authorize them ( I prefer JWT token ) for some other routes like /cars ( for adding their car ) .

I will be thankful if anyone could HELP ME .

0 likes
4 replies
Ben Taylor's avatar

The first thing to do is go back to using the regular users table along with roles to cater for the different types of users. Will save you a lot of headaches

1 like
martinbean's avatar

I'm not using default Users table but three tables : Drivers, Passengers and Admins.

@amyrosein Don’t. Just use roles. If a user has taken trips and then wants to also register as a driver, let them do it from the same account. Then use authorisation to check what roles a user has when accessing routes such as adding cars, and only allow a user to add a car if they have the “driver” role.

1 like
martinbean's avatar

@Amyrosein Just to add to this, here is a screenshot of my Uber app account settings, where I can sign up as a driver from my account:

https://i.imgur.com/zSc4la3.png

So whilst there may be a separate app for drivers, it’ll use the same account they use as a “regular” rider.

1 like

Please or to participate in this conversation.