I implemented FOSOAuthServerBundle in my application to provide an API for mobile application. It seems to work, the user gets the Token
and also the RefreshToken
but if I make the controller require the user object that always returns null
. Also fails the control of the permission, which is only IS_AUTHENTICATED_ANONIMOUSLY
.
example:
public function showUserAction(){
$user = $this->getUser()
//$user = null
$auth = $this->get('security.context')->isGranted('IS_AUTHENTICATED_FULLY')
//$auth = false
}
How to get the user object in a controller with this type of authentication?