Support the ongoing development of Laravel.io →
Configuration Authentication Session

I'm trying to do a mobile app which will talk to the backend server based on laravel frame to perform CRUD operations.

however, i also need to authenticate users before they're allowed to perform such operations

also, I need their user ID by calling Auth::user()->id to keep track of the operations they have done so far

so my question is, should I just use Auth::check() to check if the user is login, or should I use other tools like Oauth2 to do that? from my understanding, rest is stateless and therefore it won't store anything inside the session, so I not sure if Auth::check works if there are multiple users using. Right now there's only one tester for the mobile counterpart so I can't be sure whether the auth::check() could be independent of the users

if oauth, which one would you guys recommend?

Last updated 3 years ago.
0

Hi,

If I were you, I'd use access token.. and store them in a database. I already implemented something similar. You can have a look on the starter restful API I made with Laravel (Token class): https://github.com/merlosy/laravel-restful-api-starter

Regards,

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

finalight finalight Joined 12 Aug 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.