title: Symfony2 oauth2 server
body: <p>I want to create a oauth2 server for my websites (3 websites, 1 login). I created the server, I used FOSUserBundle and FOSOAuthServerBundle, I followed the instructions.</p>
  
  <p>But I have 1 problem. I can create token through /oauth/v2/token this is fine.
  I can go to /oauth/v2/oauth, but when I'm redirected to the website, I have examle.com?error=invalid_request&amp;error_description=Invalid+response+type.</p>
  
  <p>And if I login at /login, I will be logged in, but no token is created. This would be fine if I only had 1 website, but I would like to make something more like Google (if you are on maps, youtube... if you want to log in, you are redirected to accounts.google.com, login, then back to the website), but I can't see how to do that right now. I guess I need to do more work, but where exactly ?</p>
  
  <p>My security.yml right now:</p>
  
  <pre><code>security:
  encoders:
      FOS\UserBundle\Model\UserInterface: sha512
  
  role_hierarchy:
      ROLE_ADMIN:       ROLE_USER
      ROLE_SUPER_ADMIN: ROLE_ADMIN
  
  providers:
      fos_userbundle:
          id: fos_user.user_provider.username
  
  firewalls:
      main:
          pattern: ^/
          form_login:
              provider: fos_userbundle
              csrf_provider: form.csrf_provider
          logout:       true
          anonymous:    true
  
      oauth_token:
          pattern:    ^/oauth/v2/token
          security:   false
  
      oauth_authorize:
          pattern:    ^/oauth/v2/auth
          anonymous: true
  
      api:
          pattern:    ^/api
          fos_oauth:  true
          stateless:  true
          anonymous:  false # can be omitted as its default value
  
  access_control:
      - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
      - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
      - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
      - { path: ^/admin/, role: ROLE_ADMIN }
      - { path: ^/api, roles: [ IS_AUTHENTICATED_FULLY ] }
  </code></pre>
  
  <p>Should I create a new login page, or user provider? Thanks :)</p>