Installing FOS User Bundle - That is not a typo!

This video is available to view for members only.

Click here to Join!

Already a member?


In this video we will go through a pre-requisite for what I believe to be a real world Symfony2 with FOS OAuth Server Bundle - the installation and basic configuration of FOS User Bundle.

pro tip: feel free to skip this video if you are already confident with setting up FOS User Bundle, or have your own User implementation.

Wait Chris, what?

You're telling me that a pre-req for FOSOAuthServerBundle is FOSUserBundle?!

No, not exactly.

What I am saying is that - in my experience - on projects of sufficient scale to warrant a FOSOAuthServerBundle installation, FOSUserBundle is usually used as our user_provider.

Your mileage may vary, and of course, you are free to use whatever setup you like.

Starting Point

We are starting this series using the RESTful API we created during the How to code a Symfony 2 RESTful API with FOS REST Bundle tutorial series.

If you haven't yet watched that series, it may be worth doing so, or giving the code a once over before continuing.

We aren't doing anything OAuth-y in this video, but what we do here will have an impact almost immediately.

Why More Bundles?

One of the recent shake-ups in Symfony-land was the publishing of the Best Practices for Organising Your Bundle.

The guideline is to store everything inside one bundle - the AppBundle.

Even though I'm going ahead with a Symfony 2.6 project here, I am going to flaunt this rule in favour of what I consider to be ease of use - in the scope of this tutorial.

The inclusion of FOS User Bundle is likely already pretty controversial, and hopefully not too confusing, so to minimise the amount of crossover, I've decided to create a UserBundle and put any FOSUserBundle stuff in there, hopefully keeping the OAuth code as separate and re-usable as possible.

Again, do what's best for your project here.

Code For This Course

Get the code for this course.

Share This Episode

If you have found this video helpful, please consider sharing. I really appreciate it.

Episodes in this series

# Title Duration
1 Installing FOS User Bundle - That is not a typo! 07:52
2 4 Key OAuth2 Terms You Need To Know 06:46
3 Creating and Using Our First OAuth2 Client 05:41
4 How Our OAuth2 Tokens Are Created 06:58
5 Client Credentials and Password Grant Types 07:43
6 Authorization Code Grant Type 04:17
7 Refresh Tokens 03:07
8 Scope and FOSOAuthServerBundle 08:12