-1

I'm working on a project which has Web Application and Mobile client. I'm using CakePHP 3.2 for developing web application. There is a table users to store user credentials and register login logout function.

I'm using DefaultPasswordHasher of CakePHP 3.

Now, I want the user to be able to register and login using Android/iOS application using the same users table and login using the hashed password generated by CakePHP or hash password while registration so that CakePHP web client can be used to login.

I'm a learner and new to CakePHP and Android.

How could I do it ?

The main problem is with the hashing of password field because CakePHP uses different technique to hash password every time.

Edit 2

login action of UsersController in CakePHP project is configured to authenticate user and return to some other action. But I want to retrieve user's data after validating.

Anuj TBE
  • 9,198
  • 27
  • 136
  • 285

2 Answers2

1

if you want to retrieve user's data, dont use return $this->redirect().

just use something like this :

$user = $this->Auth->identify();
if($user){ return $user; }
Yosi Azwan
  • 497
  • 4
  • 15
0

Using same user table you can register login and logout in your web application and android application .

please check this link login. its help you to solve your issue.

thanks.

  • I know how to do in CakePHP. I have already developed application in CakePHP. I want to know how to use `login` action of CakePHP controller and retrieve user data if credentials match in an Android application. – Anuj TBE Jul 04 '16 at 11:25
  • Please see my `Edit 2` – Anuj TBE Jul 04 '16 at 11:38