I am developing a typical PHP app which will be accessed in two ways
- Single Page application using session based authentication
- API based using OAuth authentication
Laravel has native support for Session based authentication and there are good packages to enable OAuth authentication but I need a combination of both. So a user accessing the app using example.com will be authenticated based on session and user acessing the app using api.example.com will be authenticated using OAuth/Token.
Should I write my own middleware to accomplish that or there are other optimal solutions for that?