What is the best Yii2 module to implement oauth2 server?

Hi,

What is the best Yii2 module to implement oauth2 server? I tried to find out best module for implement oauth2 server in Yii2, I found https://github.com/Filsh/yii2-oauth2-server but this is so old and unreliable, I try to find a module working with https://oauth2.thephpleague.com in Yii2 like https://laravel.com/docs/5.7/passport in Laravel.

Can anyone help me make a better choice?

1 Like

What is stopping you from using https://oauth2.thephpleague.com? From my experience it is very easy to use and integrate into a Yii application.

I thought a Yii module has more easy and faster implementation, etc migrations prepared, models and …

Any example exists about implements oauth2 server https://oauth2.thephpleague.com/ in Yii2 ?

What is your opinion about this package? https://github.com/asamats/yii2-passport

@samdark
Hi Alexander, you don’t have any opinion about this topic? I think it’s important and core extension for Yii2 framework and should be exists.

No opinion. I’ve implemented a server myself once. Hard part is to understand OAuth. Implementation isn’t that bad and something like https://oauth2.thephpleague.com/ could help.

1 Like

You think Yii2 don’t need to a module like Passport in Laravel to implements oAuth server? https://laravel.com/docs/5.7/passport

It’s OK to have it but I’d prefer community-made one rather than one maintained by core team. We have enough extensions to handle already.

1 Like

I’ve implemented PHP League OAuth2 library recently - difficult part of it was to wrap Yii’s Response and Request objects into PSR-7 compatible classes (as we can expect it in Yii 3) the rest is quite straightforward.

1 Like

Hi,
How did you manage to tie that with identity interface? I think that is the most difficult stage. As of wrapping reponse, you can use Zend diactoros and skip Yii requests where possible and play the two together in the rest!