Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Shobi
Shobi

Posted on

     

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 inIN the Laravel server?
  • Keep the token in session with some key?
  • How do I make this work with theAuth::user() functionality in the Laravel Server?
  • Or what are some good approaches to this problem?

Top comments(2)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss
CollapseExpand
 
achoarnold profile image
Arnold Acho
I'm a full stack web developer who loves writing clean code to solve interesting problems using Go, C#, and Vue.js. I ❤ Docker.
  • Email
  • Location
    Tallinn, Estonia
  • Work
    Software Engineer at Microsoft
  • Joined

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.

CollapseExpand
 
johnmccuk profile image
John McCracken
Cloud Engineer
  • Location
    Ayr, Scotland
  • Work
    Cloud Engineer
  • Joined

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

jwt-auth repository

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

PHP Ninja, Python Lover.
  • Work
    Full Stack Developer
  • Joined

More fromShobi

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp