Search code examples
symfonyoauth-2.0fosoauthserverbundle

Skip authorization page with oAuth 2 and FOSOAuthServerBundle


I've successfully installed and tested the OAuth 2 workflow with Symfony 2 and FOSOAuthServerBundle.

I can request a code, and get a pair of access/refresh token successfully from a "login with" button on a third party test page i've set up and retrieve a user from my API through a custom API call. Pretty cool here.

However, each time I test the flow from the beginning, my oAuth server keeps on redirecting the user on the authorization page. Here are my questions.

  • Once a user has authorized and app, shouldn't the authorization part of the process be skipped with OAuth 2.0 ?
  • Is that fixed on the server side or should i change the way i request the credentials on client site ?
  • And finally... could i debug and fix this ?

Solution

  • If anyone struggles again, the solution is here :

    https://github.com/FriendsOfSymfony/FOSOAuthServerBundle/blob/master/Resources/doc/the_oauth_event_class.md

    This feature is not default in FOSOAuthServer bundle. You have to create and EventListener and check client or user status, save the user's choice, and [quote:even bypass the authorization process].