How to login with php and session in ionic?

2

I'm making a mobile application with ionic and I need to login to external database users, I need to know how I can login through php and create a session with id of user ?

    
asked by anonymous 05.08.2015 / 16:17

2 answers

2

Make Token face, I've tried with session, cookies, but token is the most recommended, keeping the status logged in the app, if that's what tabm you want;

Use this link with support: Autonic IONIC / TOKEN / AngularJS

    
08.08.2015 / 19:29
0

As @Vagner said token is the most recommended. But if you want an example with session maybe this might help:

//Atribui o objeto usuário a referencia usuarioLogado no sessionStorage
sessionStorage.setItem('usuarioLogado', usuario);

Then if you want to recover this user you can do:

/**Pega o objeto armazenado no sessionStorage, 
observe que a referencia é a mesma('usuarioLogado')*/
$scope.usuarioLogado = sessionStorage.getItem('usuarioLogado');
    
05.11.2015 / 12:31