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

NovikovAleksey's avatar

Login User from API

Hello,

I have a question. Sorry for this question, it might be a very stupid one, but can I login user thought API?

I have a WordPress landing page from which I need to send login credentials via POST request to Laravel site and if everything is fine redirect to already logged dashboard (for example).

What is the best way to do it? Should I just use Auth::attempt($credentials)? Can someone share best practices for doing this?

0 likes
1 reply
siangboon's avatar

where the dashboard hosted?? wordpress? how the wordpress going to validate each request is from the authenticated user?? the dashboard or other pages from the site need something to validate the session is authenticated , usually token is commonly in used.

Please or to participate in this conversation.