PHP Rest Application with Logged in User

Asked

Viewed 241 times

0

I am developing an application in PHP Rest API. This application will be accessed via Web and Mobile.

It happens that users must log in to be able to consume the Rest service.

My question - How do I keep users logged in to a REST application?

Note. I intend to use Angularjs in front-end

Grateful for the attention.

1 answer

1


In that case, your front-end is irrelevant, I’d say. You can store the user data in cookie or Storage (the angular has this service already integrated), preferably cookie that you can control the validity, and whenever it is necessary to verify that the user is logged in, you send this information to the server and do the validation.

Example: generate a token with some login information to be verified, such as email, id and encrypted mode name.

That’s the basic idea. Store some cookie information, whenever the user accesses the app or accesses some restricted area, send this cookie to the server and validate the user authentication.

  • Thank you Celsom, I’ll try it the right way!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.