Application Rest in PHP with user logged in

0

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

It turns out that users should log in to be able to consume the Rest service.

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

Obs. I want to use AngularJs on the front end

Thank you for your attention.

    
asked by anonymous 24.03.2016 / 16:12

1 answer

1

In that case, your front end is irrelevant, I would say. You can store the user data in a 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 if the user is logged in, you send this information to the server and it does the validation.

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

The basic idea is this. Store some information in cookie, whenever the user accesses the app or access some restricted area, send that cookie to the server and validate the user's authentication.

    
24.03.2016 / 16:39