Multiple Laravel apps under one instance and one Passport authentication


#1

İ 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.


#2

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?


#3

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


#4

So why not use one database per app?


#5

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


#7

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


#8

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


#9

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.


#10

I want app to be modular.


#11

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.


#12

thanks for greater explanation source. The version of https://github.com/lucadegasperi/oauth2-server-laravel doesn’t match my current laravel version and seems this will be useless.
Anyway great thanks i will try to find alternate solutions.