When trying to check if the user is authenticated or not in the layout
{% if is_granted('IS_AUTHENTICATED_FULLY') %} <p>Username: {{ app.user.username }}</p> {% endif %}
I get an error like
Twig_Error_Runtime in Template.php line 304: An exception has been thrown during the rendering of a template ("The token storage contains no authentication token. One possible reason may be that there is no firewall configured for this URL.") in "layout.html" at line 39.
This is a security firewall configuration. I only need to allow users to enter the website.
$app->register(new SecurityServiceProvider(), array( 'security.firewalls' => array( 'dev' => array( 'pattern' => '^/(_(profiler|wdt)|css|images|js)/', 'security' => false ), 'login' => array( 'pattern' => '^/login$', ), 'secured' => array( 'pattern' => '^.*$', 'form' => array('login_path' => '/login', 'check_path' => '/login_check'), 'logout' => array('logout_path' => '/logout'), 'users' => $app->share(function() use ($app) {
Any ideas for fixing this are welcome.
thanks
source share