Laravel App的多个身份验证系统

I am developing a typical PHP app which will be accessed in two ways

  1. Single Page application using session based authentication
  2. 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?