Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

ohms238's avatar

Access Laravel project with passport.

I'm currently running a project with Laravel 5.6 Normally I would login to the system with username and password. Then I could access all the pages. I need to create a desktop electron app. In this app I need to be able to login to the system and then when a certain condition is met it'll open a page from the laravel system. Not an api call but just open the page in a browser.

From what I understand I would passport but I don't want to make just api calls. I want to open the regular pages. So I need away to get the token and then have it interact with the regular Laravel routes as if I was logged in.

Would the steps be

  1. Create passport token on client
  2. Access regular browser pages passing the passport token in the header?
0 likes
1 reply
gitwithravish's avatar

@ohms238 I tried to look for a dedicated solution to this but no luck.

Best is to make a small middleware of your own to deal with this.

  • Create a token and save to database before redirecting from electron app to browser.
  • Pass that token in browser
  • Keep a middleware that checks for this token
  • If middleware finds this token, it will check the token with the token saved in database.
  • If it passes the validation, then login the user using Auth

Please or to participate in this conversation.