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

donatmarko's avatar

Registering and authenticating users from external login API

Hello folks,

I'm kinda beginner in the "deeper" working method of Laravel, that is why I am asking this question here. Given a Laravel 5.7 application and an external login API that I want to authenticate the application from.

Upon login, the API shall be called with the following pattern: https://login.example.com/?url=https://laravelapp.com

If our domain is whitelisted for using the API, it redirects the URL https://laravelapp.com/?token=........, otherwise ...?token=error

With this token that API passed to us, we can retrieve the user data in JSON format by calling https://login.example.com/user.php?token=............

App shall use the login API every time when a user logs in, and upon first login we shall register a new user instance to "users" table with the data retrieved from the API.

Thank you in advance!

D

0 likes
0 replies

Please or to participate in this conversation.