I'm trying to register/login users in my web app by using Satellizer Facebook auth.
One of Satellizer's Facebook authenticate cycle requires making a post request to backend(Laravel PHP) /auth/facebook
by passing a code obtain from facebook.
The following actions are performed at backend
- Retrieval of user's facebook profile, in this case to Laravel.
- Create users if they don't exists
- Return JWT code back to client (Satellizer)
The problem is, it seems post requests are never made to /auth/facebook
however Satellizers still logs users in.
Kindly see code below:
In Angular config:
$authProvider.facebook({
url: '/auth/facebook',
clientId: '93488373912012901',
responseType: 'token',
authorizationEndpoint: 'https://www.facebook.com/v2.5/dialog/oauth',
redirectUri: 'http://site.dev/auth/facebook/callback', //registered in FB App
requiredUrlParams: ['display', 'scope'],
scope: ['email'],
scopeDelimiter: ',',
display: 'popup',
oauthType: '2.0',
popupOptions: { width: 580, height: 400 }
});
Somewhere in Angular controller (ControllerAs)
auth.authenticate = function()
{
$auth.authenticate('facebook').then(function(response)
{
dd(response); //
}).catch(function(response) {
dd(response);
});
};
In Laravel
$router->post('/auth/facebook', 'Auth\SocialController@authenticate');
In Laravel SocialController
public function authenticate($provider='facebook')
{
\Log::info('here');
if ($this->request->has('redirectUri')) {
config()->set("services.{$provider}.redirect", $this->request->get('redirectUri'));
}
$profile = Socialite::driver($provider)->stateless()->user();
\Log::info( $profile);
//JWT goes here
}
As you can see in the authenticate method, I have \Log::info('here');
this should simply send a log to storage/laravel.log
but nothing is being logged and the logging system work perfectly.
Please what am I missing?
via Digitlimit