Search code examples
phpoauth-2.0cakephp-3.0thephpleague

How to add OAuth2 Server on a CakePHP 3 plugin


I am working on a plugin in CakePHP3 and I need to create a simply Oauth 2.0 Server API that allows to do a simple CRUD on the users' table and create sessions when needed.

I have done some research here in StackOverflow and it seems that the best choice would be https://github.com/uafrica/oauth-server

Now, I have tried to make it work according to the doc in the repository but since it will be a plugin, not the core of the application I do not understand how it is supposed to work and which file I need to update.

Would somebody be so kind to give me the list of steps I need to follow and the actual files that need to be updated?

Many Thanks in advance


Solution

  • The uafrica/oauth-server project is woefully out of date. It requires v4.1 of league/oauth2-server, which is now currently at v7.2. Version 5 of that project was completely rewritten and is not backwards compatible with v4.x.

    I don't think there's an out-of-the-box CakePHP 3 plugin that works with the current version of league/oauth2-server.

    You'll have to either build your own plugin from scratch, or try to hack the uafrica/oauth-server project to get it work with league/oauth2-server.