gigablah / silex-oauth

Silex provider for lusitanian/oauth.
MIT License
109 stars 24 forks source link

not compatible Silex 2.x #15

Closed josedacosta closed 9 years ago

josedacosta commented 9 years ago

hello, your demo is not compatible Silex 2.x, it would be good to mention it in the readme.txt, or do the updates, thank you

Silex 1.x use Silex\ServiceProviderInterface; Silex 2.x use Pimple\ServiceProviderInterface;

ArnaudLigny commented 9 years ago

The required Silex version is indicated in the installation section: "silex/silex": "~1.0",

kabudu commented 9 years ago

@josedacosta There is a fork of this library which is meant to be compatible with Silex 2.x, https://github.com/atphp/silex-oauth

I have tried this fork but it does not appear to work with Silex 2.x. The reason it does not work is because:

The documentation says that the OAuthServiceProvider should be registered before the SecurityServiceProvider for obvious reasons, as the oauth authentication listener needs to be registered. However, the OAuthServiceProvider makes use of the $app['security'] context which will not exist until the SecurityServiceProvider has been registered.

I have not yet found a way around this problem, maybe the original author of this library may have some suggestions.

gigablah commented 9 years ago

The constructor signature has actually changed for Silex 2.x, you now have to pass in $app['security.token_storage'] instead of $app['security']. That was the missing part of the puzzle.

I've created a 2.0.x branch (aliased to dev-master or 2.0@dev) which works with Silex 2.x and Pimple 3.0. Let me know if it works for you.

kabudu commented 9 years ago

Thanks @gigablah, I'll give it a try!