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

maheshbhanushali's avatar

authenticate user with external api and on success set session

Hi people, I have two tables users and sellers. users table have admin,manager,dataentry detail and sellers have sellers detail. Presently I using laravel auth to authenticate admin,manager,dataentry against users table and its working perfectly. In my auth config, user model and table is configured for authentication. Now my issue is, to authenticate sellers I am using external api and on success reponse I want to set seller session. I try this Auth::login(Seller::find(sellerid)), but this is not working. Can some one help me out with this problem.

0 likes
3 replies
rdelorier's avatar

What do you mean when you say its not working, Is it throwing an error?

maheshbhanushali's avatar

@rdelorier I mean session is not getting set and redirecting back to signin page. In Authenticate.php middleware I am getting true for this $this->auth->guest().

depsimon's avatar

You need to bind a seller to a user. Then you should be able to login using :

Auth::login(Seller::find(sellerid)->user_id);

Please or to participate in this conversation.