Adonis works with JWT authentication with one model (User). But i need a way to use it with other model (Customer).
The use case:
I am creating an system for discount and coupons… And is used both in browser and mobile and works in multitenant way and AdonisJS is used to provide all API.
So if a restaurant owner want to add an discount offer for his monday dinners, he must be authenticated as an user of this restaurant… this point is fine. It has rules and permisssion to that for model User and of course, JWT authentication to the User model too.
But tomorrow, he can be an Customer of an shoes store, and need to use my app on his mobile device to get his coupon. So i need to make him authenticate as Customer, not as user… And in same scenarios i want to use email as the uid… and of cource, a different route to do that… all mobile access on my api has a preffix mob.…
How can i do to implement multi model authentication?
Laravel framework for PHP provides an easy way to implement it by using extending the Authenticatable class… and i need to make something like this