Multiple Laravel apps under one instance and one Passport authentication


İ am building multiple laravel applications under one laravel instance. My project structure is below.

Laravel instance

App1 all folders (except vendor)
App2 all folders (except vendor)
UserApp all folders (except vendor) Vendor folder.

I have built as above shown. Every project works separately without problem. I also use laravel passport package for authentication. But i use for authentication only UserApp and each of three project has own schema. Passport package allow me to use authorization in only from schema where passport (oauth) folders exists. How can i use one passport authentication for different app with different schemas. Thanks in advance.


Sounds to me like it’s time to break the three applications apart. It already sounds a bit messy as is, and this will only get worse.

There seems to be no reason to mix the three, so why do it?


this for the reason that there will be more table and not to mess tables of different apps


So why not use one database per app?


when i use one database per app how i will handle passport authentication (token based) if passport tables are in user app?


So the apps are all using the users from the user app by directly reading the database from the user app?


The user app is responsible for user registering from outside,
authentication and
checking token when sending token based request


And why is there a separate app for that? Why is not part of the other apps?

It really sounds like you’re making thing way too complex.

Either that, or you’re actually looking to implement something like OAuth.


I want app to be modular.


As you can see in this discussion there doesn’t seem to be official Laraval support for making Passport use a different database connection than the rest of an application.
There are a few hacky suggestions in this thread none of which seems to work perfectly.


thanks for greater explanation source. The version of doesn’t match my current laravel version and seems this will be useless.
Anyway great thanks i will try to find alternate solutions.