I want to use an external Login (OAuth 2) with my CakePHP3 App. (The external Login need a Password and a Email). I never use an external Auth for my Applications (Everytime I use only my own Database with the Basic Auth of CakePHP3, so I have no clue what I should do)
In my AppController I write this :
$this->loadComponent('Auth', [
'authenticate' => [
'Basic' => [
'fields' => ['username' => 'email', 'password' =>'password'],
], ],
'loginAction' => [
'controller' => 'Users',
'action' => 'login'
]
]);
$this->Auth->config('authenticate', 'OAuth2');
And in my OAuth2Authenticate.php
public function authenticate(Request $request, Response $response)
{
$http = new Client();
$response = $http->get('http:xxx/login', [], [
'auth' => ['username' => 'email', 'password' => 'password']
]);
}
But I cannot get access to the User?
Is there any helpful Tutorial out there or Examples where I can learn, to build up a external Login to CakePHP3?