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

cmdobueno's avatar

API & Authentication

Alright, got a bit of an interesting question.

I have two systems, 1 is an API, the other is a frontend. I am trying to figure out how to stay logged in on the frontend system. I have given thought to using the users table, and when a user connects to the API, does their authentication, they front-end system will just 'create' a user for them and authenticate them that way. Storing the required tokens and all that.

I am just not sure if that is reasonable or not.

Thanks

0 likes
2 replies
ftiersch's avatar

How do you authenticate on the API?

If you use JWT you could simply create a token with a very long time to live, since that's stateless and the information is in the token anyway your api wouldn't have to be concerned with it.

samhk222's avatar

Have you ever considered using redis? I'm new to laravel, so i couldn't help more :(

Please or to participate in this conversation.