DEV Community

Shobi
Shobi

Posted on

2 2

How do I tie Laravel and Lumen together?

I have asked this question in SO, But no responses after 20 Hours, if any of you guys can help it by either answering here, or give an upvote in SO so that it gets more attension.Original Stack overflow question

I am building an application from scratch which has 2 main parts

  1. A Laravel server - Which will serve HTML pages by querying an API (Preferably no DB interaction)
  2. A Lumen Server - Which will be the API being queried (DB interaction goes here)

Now I need to log in a user.

I can send username and password from laravel server to the lumen API and get a token back (I think it's the way, correct me if I am wrong).

  • After that what should I do to make the user logged in IN the Laravel server?
  • Keep the token in session with some key?
  • How do I make this work with the Auth::user() functionality in the Laravel Server?
  • Or what are some good approaches to this problem?

Warp.dev image

The best coding agent. Backed by benchmarks.

Warp outperforms every other coding agent on the market, and gives you full control over which model you use. Get started now for free, or upgrade and unlock 2.5x AI credits on Warp's paid plans.

Download Warp

Top comments (2)

Collapse
 
achoarnold profile image
Arnold Acho

I think many things will depend on the specifics of the App.

TO understand you better, You want to build say 2 microservices where 1 serves as an API where the other service just consumes data from the API

Now you can implement a use the Implement the JSON Web Token authentication as another User above mentioned.

So the Lumen App will be the server which generates the token while the laravel app will use the token generated by the Lumen app to perform it's authentication.

Collapse
 
johnmccuk profile image
John McCracken

You could try integrating JSON Web Token (JWT) authentication and making it stateless.

jwt-auth repository

Runner H image

Automate Your Workflow in Slack, Gmail, Notion & more

Runner H connects to your favorite tools and handles repetitive tasks for you. Save hours daily. Try it free while it’s in beta.

Try for Free

👋 Kindness is contagious

Discover fresh viewpoints in this insightful post, supported by our vibrant DEV Community. Every developer’s experience matters—add your thoughts and help us grow together.

A simple “thank you” can uplift the author and spark new discussions—leave yours below!

On DEV, knowledge-sharing connects us and drives innovation. Found this useful? A quick note of appreciation makes a real impact.

Okay