How to login with php and Session on Ionic?

Asked

Viewed 2,629 times

2

I’m making a mobile app with ionic and I have to log in users from an external database, I need to know how to log in via php and create a session with id user’s ?

2 answers

2

Do with Token dude, I’ve tried with Ssion, cookies , but token is the most recommended, keeping the status logged in the app, if that’s what tabm want;

Use this link with support: IONIC / TOKEN /Angularjs authentication

0

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

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

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

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

Browser other questions tagged

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