We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Description Using the function getUser() from the ResourceController is not working in Symfony 6.
Steps to reproduce Try to use getUser() in a controller and to view it.
Possible Solution Use DI for the service 'security.token_storage' in the ResourceController
The text was updated successfully, but these errors were encountered:
You might be missing the security bundle, which should be indicated in the logs. This is what the getUser() method looks like:
getUser()
protected function getUser() { if (!$this->container->has('security.token_storage')) { throw new \LogicException('The SecurityBundle is not registered in your application. Try running "composer require symfony/security-bundle".'); } if (null === $token = $this->container->get('security.token_storage')->getToken()) { return null; } if (!\is_object($user = $token->getUser())) { // e.g. anonymous authentication return null; } return $user; }
Sorry, something went wrong.
No branches or pull requests
Description
Using the function getUser() from the ResourceController is not working in Symfony 6.
Steps to reproduce
Try to use getUser() in a controller and to view it.
Possible Solution
Use DI for the service 'security.token_storage' in the ResourceController
The text was updated successfully, but these errors were encountered: