I've implemented Lucade Gasperi's oAuth2 server for laravel which can be found here https://github.com/lucadegasperi/oauth2-server-laravel
I am trying to return the user id of the token in the /apps/filters.php
but no value is returned. I am using this ResourceServer::getOwnerId()
.
If I add ResourceServer::getOwnerId()
inside /apps/routes.php
it will return the user id.
Here is the code
/apps/filters.php
Route::filter('auth_token', function(){
exit(ResourceServer::getOwnerId());
});
Response:
/apps/routes.php
Route::post('test', array('before' => 'oauth', function(){
exit(ResourceServer::getOwnerId());
}));
Response: 4
As you can see when I add ResourceServer::getOwnerId()
to the Filter it doesn't return the ID.
The filter is working. If I return a random string it will return the string.
Have I missed something? Is it even possible to use ResourceServer::getOwnerId()
inside filters.php
Is it because the oauth is getting called after the filter?