PHPackages                             ciricihq/cake-oauth2-client - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. ciricihq/cake-oauth2-client

ActiveCakephp-plugin

ciricihq/cake-oauth2-client
===========================

OAuth2Client plugin for CakePHP

218[1 issues](https://github.com/ciricihq/CakeOAuth2Client/issues)PHP

Since Nov 20Pushed 10y ago5 watchersCompare

[ Source](https://github.com/ciricihq/CakeOAuth2Client)[ Packagist](https://packagist.org/packages/ciricihq/cake-oauth2-client)[ RSS](/packages/ciricihq-cake-oauth2-client/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

OAuth2Client plugin for CakePHP
===============================

[](#oauth2client-plugin-for-cakephp)

This plugin provides OAuth2 Password grant scenario to your cake3 projects.

Installation
------------

[](#installation)

You can install this plugin into your CakePHP application using [composer](http://getcomposer.org).

```
composer require ciricihq/cake-oauth2-client

```

Setup
-----

[](#setup)

This plugin needs the next two configations parameter blocks to fit your system requirements:

```
Configure::write('App.OAuth2Client.routes', [
    'base_uri' => 'http://your-api.url', // The OAuth2 API endpoint
    'access_token_path' => '/oauth/v2/token', // The access token url relative to base_uri
    'refresh_token_path' => '/oauth/v2/token', // The refresh token url relative to base_uri
]);
```

```
Configure::write('App.OAuth2Client.keys', [
    'client_id' => 'your-client-id', // The client id needed to request the access token
    'client_secret' => 'your-client-secret', // The client secret needed to request the access token
]);
```

You can add them in your app.php configuration file in the App array.

```
'App' => [
    ...
    ...
    'OAuth2Client' => [
        'routes' => [
            'base_uri' => 'http://your-awesome-oauth-api-endpoint.url'
            'access_token_path' => '/oauth/v2/token',
            'refresh_token_path' => '/oauth/v2/token',
        ],
        'keys' => [
            'client_id' => 'you_client_provided_id',
            'client_secret' => 'you_client_provided_secret'
        ]
    ]
],
```

To enable the plugin add the next line in your bootstrap.php

```
Plugin::load('OAuth2Client', ['bootstrap' => true, 'routes' => true]);
```

In your AppController.php you should have the next codes in order to access your generated AccessToken.

```
    public function initialize()
    {
        parent::initialize();

        $this->loadComponent('Flash');

        $this->loadComponent('Auth', [
            'loginAction' => [
                'controller' => 'AuthController',
                'action' => 'login'
            ],
            'loginRedirect' => [
                'plugin' => 'OAuth2Client',
                'controller' => 'Auth',
                'action' => 'login'
            ],
            'authenticate' => [
                'OAuth2Client.OAuth2'
            ],
            'authorize' => ['Controller']
        ]);
    }

    public function beforeFilter(Event $event)
    {
        $authUser = $this->Auth->user();

        // Here you are setting AccessToken, RefresToken and ExpiresIn to all the controllers and views in order to handle later
        // you can set cookies or whatever you need
        $this->set('authUser', $authUser);
        $this->set('access_token', $authUser['access_token']);
        $this->set('refresh_token', $authUser['refresh_token']);
        $this->set('token_expires', $authUser['expires_in']);
    }

    public function isAuthorized()
    {
        $user = $this->Auth->user();
        if (isset($user['access_token'])) {
            return true;
        }

        return false;
    }
```

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/9cbcbe685af90849bdd806d22ba8c315093bdeb6b2c46c874108b69f81c23038?d=identicon)[gtrias](/maintainers/gtrias)

![](https://www.gravatar.com/avatar/d8f46469b5c3f5f745308d4edb9c55afbd160e0193da99e903365ea82b749cee?d=identicon)[elboletaire](/maintainers/elboletaire)

---

Top Contributors

[![elboletaire](https://avatars.githubusercontent.com/u/153305?v=4)](https://github.com/elboletaire "elboletaire (1 commits)")

### Embed Badge

![Health badge](/badges/ciricihq-cake-oauth2-client/health.svg)

```
[![Health](https://phpackages.com/badges/ciricihq-cake-oauth2-client/health.svg)](https://phpackages.com/packages/ciricihq-cake-oauth2-client)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
