I have a Symfony 2.3.7 application which uses FOSUserBundle for user management. Till now, the app has been standard MVC with Twig used for templating. Now we are moving toward an Angular based single page application and taking many of the controllers in the original app and converting them to return jsonresponses that the frontend JS will call. Most of this is under way and under control.
My question is on user authentication. Since we need to also replace the login twigs, I'm trying to figure out the most efficient way to manage the user auth. In twig it was very simple:
{% if app.user %}
{# display loggedIn user data #}
{% endif %}
So one way of phrasing the question is ... Is there a way to expose the global app variables (session, user etc) via json? Or is there another way that I haven't thought of yet?
Actually you should not share environment variables between 2 environments. You have many solutions for your login, but you should not use twig.
In everycase, sharing environment variable is not a good idea for me since it comes with following problems: