FOSOAuthServerBundle
FOSOAuthServerBundle copied to clipboard
[Symfony 4] Installation
Are there any docs covering installation on Symfony 4? I haven't found a recipe for Flex, should I be aware of any caveats?
I'm running on Symfony 4 (traditional, not flex).
Things I needed to configure were the templating section in framework.yml (also install the templating component). And a minor security.yml edit to allow multi route pattern firewalls. Because otherwise you have 2 login forms on your website.
templating section
framework:
# ... your config
templating:
hinclude_default_template: ~
form:
resources:
- FrameworkBundle:Form
cache: ~
engines:
- twig
loaders: []
security.yml firewall edit
# ...
firewalls:
api:
pattern: ^/api
fos_oauth: true
stateless: true
anonymous: false
main:
pattern: ^/
form_login:
check_path: login # name to check_path route
login_path: login # name to login_path route
logout: true
anonymous: true
oauth_authorize:
pattern: ^/oauth/v2/auth|^/login* # this does the magic. Just use a regex to have multi-route-firewalls
form_login: ~
anonymous: true
oauth_token:
pattern: ^/oauth/v2/token
security: false
what is the idea behind symfony 5.0 and 4.3 support deprecation free?
Right now Symfony 4.3 is throwing deprecations because of use of "templating" and it seems not possible to disable "templating" and have deprecation free 4.3 because bundle rely on the templating and symfony is checking for templating service before fallback to twig.
EDIT:
it seems possible if you dont need default authorize controller.
You should not include routing/authorize.xml and set in config authorize: false that will not load config/authorize.xml and templating service will not be required. You lost default authorize controller and templates but win deprecation free ( we dont use default one anyway )