Link to home
Start Free TrialLog in
Avatar of DanteAdmin
DanteAdminFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Login with Angular JS

Hello

I'm fairly new to Angular and turning an excisting PHP web application in to Angular. It's going well so far but I'm now stuck at the login bit and hoping someone can assist

The system has got several users, each operate in their own area where they can add their customers, update them, delete them etc - we are also running reporting for them

This is how the old system worked with login:
API call to the service using CURL / PHP and if the username / password is correct we take the ID of that user and store is in a session

User login -> Check authentication -> Set ID / Tokein Session -> Display data depending on the ID

Now this works fine and after 20min inactivity the session dies, or the client logs out. On each page we check if there is an ID and if not the user is sent to the login page


In Angular JS I thought there would be a session or similar so I could still use the session state, but I can't find anywhere if we can reach the server-side sessions or not ?


So I thought instead of me trying to do something halfway I would like to hear what is the correct way for me to do this

Once in the system everything will operate with the ID, posts, delete, updates etc will always have for the API or SQL statment "WHERE ID =''"

What's the best way of doing this in Angular JS

User login -> Run API call to see if correct -> If yes what ID is there -> Save ID so we can retrieve it from any page further on in the system (just like you can with a session)

Many thanks
ASKER CERTIFIED SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial