PHPackages                             hrevert/ht-oauth-server-client-module - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. hrevert/ht-oauth-server-client-module

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

hrevert/ht-oauth-server-client-module
=====================================

A Zend Framework 2 module which provides custom grant for zfr-oauth2-server to authenticate users via third party applications like facebook, google etc

0.3.0(10y ago)4262MITPHPPHP &gt;=5.5

Since Aug 22Pushed 10y ago3 watchersCompare

[ Source](https://github.com/hrevert/ht-oauth-server-client-module)[ Packagist](https://packagist.org/packages/hrevert/ht-oauth-server-client-module)[ RSS](/packages/hrevert-ht-oauth-server-client-module/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (6)Dependencies (10)Versions (9)Used By (0)

HtOauth\\Server\\ClientModule
=============================

[](#htoauthserverclientmodule)

A Zend Framework 2 module which provides custom grant for [zfr-oauth2-server](https://github.com/zf-fr/zfr-oauth2-server) to authenticate users via third party applications like facebook, google etc.

[![Master Branch Build Status](https://camo.githubusercontent.com/da2644ef1277a32a5c5f52db9300449904eea5742280eb5789da63fe8259098c/68747470733a2f2f6170692e7472617669732d63692e6f72672f687265766572742f68742d6f617574682d7365727665722d636c69656e742d6d6f64756c652e706e673f6272616e63683d6d6173746572)](http://travis-ci.org/hrevert/ht-oauth-server-client-module)[![Latest Stable Version](https://camo.githubusercontent.com/305dc72f46c269189b2582b9a889d200cb65717527a8fc328e6e3a4bd7f9f9dd/68747470733a2f2f706f7365722e707567782e6f72672f687265766572742f68742d6f617574682d7365727665722d636c69656e742d6d6f64756c652f76657273696f6e2e737667)](https://packagist.org/packages/hrevert/ht-oauth-server-client-module)[![Latest Unstable Version](https://camo.githubusercontent.com/c60205d706db19de77693145bc33002c2eb18b6ce93c9b7135af384798f320a1/68747470733a2f2f706f7365722e707567782e6f72672f687265766572742f68742d6f617574682d7365727665722d636c69656e742d6d6f64756c652f762f756e737461626c652e737667)](//packagist.org/packages/hrevert/ht-oauth-server-client-module) [![Total Downloads](https://camo.githubusercontent.com/de75e10ac9773b514be7e4f96970bd27bb7a253793c80cf4ddd1f39c11a06c56/68747470733a2f2f706f7365722e707567782e6f72672f687265766572742f68742d6f617574682d7365727665722d636c69656e742d6d6f64756c652f646f776e6c6f6164732e737667)](https://packagist.org/packages/hrevert/ht-oauth-server-client-module)

### What's with the name?

[](#whats-with-the-name)

The module provides a grant for a oauth2 server and it is also a client for oauth2 servers of facebook, google etc. So, it is named as server as well as client.

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

[](#installation)

- Add `"hrevert/ht-oauth-server-client-module": "0.3.*"` to composer.json and run `php composer.phar update`.
- Enabled the following modules in `config/application.config.php`.

```
'modules' => array(
    'ZfrOAuth2Module\Server',
    'HtLeagueOauthClientModule',
    'HtOauthClientModule',
    'HtOauth\Server\ClientModule',
),
```

Configuring the module
----------------------

[](#configuring-the-module)

#### Setting the User class

[](#setting-the-user-class)

User class must implement `Hrevert\OauthClient\Model\UserInterface`. Then, you need to modify the Doctrine mapping to associate this interface with your own user class.

```
return [
    'doctrine' => [
        'entity_resolver' => [
            'orm_default' => [
                'Hrevert\OauthClient\Model\UserInterface' => 'Application\Entity\User'
            ]
        ]
    ]
]
```

#### Provider configuration

[](#provider-configuration)

You need to define the credentials like client id, client secret and other configuration. Read [this](https://github.com/hrevert/HtLeagueOauthClientModule/tree/0.2.0) for these configuration.

#### Adding grant types

[](#adding-grant-types)

```
return [
    'zfr_oauth2_server' => [
        'grants' => [
            // .. other grants,
            'HtOauth\Server\ClientModule\Grant\Oauth2Client',
        ]
    ]
]
```

#### Enabling providers

[](#enabling-providers)

Enable providers by adding records to the table `oauth_provider`.

#### Autocreating user

[](#autocreating-user)

When a new user tries to log in, s/he is not allowed to log in by default.

To automatically create a new user, you need to specify a callable for creating a user.

```
return [
    'ht_oauth_service_client' => [
        'create_user_callable' => function(\HtLeagueOauthClientModule\Model\UserInterface $userDetails) {
            $user = ......;

            $userProvider = new \Hrevert\OauthClient\Entity\UserProvider();
            $userProvider->setUser($user);

            return $userProvider;

            // or just

            $user = ......;

            return $user;
        }
    ]
];
```

How It Works
------------

[](#how-it-works)

### Login with OAuth 2.0

[](#login-with-oauth-20)

1. **Client:** Client sends a `POST` request to the server at */oauth/token* with oauth2 authorization code or access token.
2. **Server:** With *authorization code*, *authorization code* is exchanged for *provider access token*.
3. **Server:** User information is retrived using the *provider access token* from **Step 2**.
4. **Server:** Look up the user by the unique *provider id*. If user already exists, grab the existing user, otherwise create a new user account.
5. **Server:** Reply with a *new access token*.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity53

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.

###  Release Activity

Cadence

Every ~70 days

Recently: every ~87 days

Total

6

Last Release

3932d ago

PHP version history (2 changes)0.0.1PHP &gt;=5.4

0.3.0PHP &gt;=5.5

### Community

Maintainers

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

---

Top Contributors

[![ojhaujjwal](https://avatars.githubusercontent.com/u/4995501?v=4)](https://github.com/ojhaujjwal "ojhaujjwal (50 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/hrevert-ht-oauth-server-client-module/health.svg)

```
[![Health](https://phpackages.com/badges/hrevert-ht-oauth-server-client-module/health.svg)](https://phpackages.com/packages/hrevert-ht-oauth-server-client-module)
```

###  Alternatives

[zf-commons/zfc-user

A generic user registration and authentication module for ZF2. Supports Zend\\Db and Doctrine2.

4851.1M70](/packages/zf-commons-zfc-user)[illuminate/auth

The Illuminate Auth package.

9327.3M1.0k](/packages/illuminate-auth)[socalnick/scn-social-auth

Uses the HybridAuth PHP library to Enable authentication via Google, Facebook, Twitter, Yahoo!, etc for the ZfcUser ZF2 module.

21974.2k3](/packages/socalnick-scn-social-auth)[amocrm/amocrm-api-library

amoCRM API Client

182728.5k6](/packages/amocrm-amocrm-api-library)[openeuropa/oe_authentication

Authentication against the OpenEuropa Authentication service.

17314.8k2](/packages/openeuropa-oe-authentication)[zfr/zfr-oauth2-server-module

Zend Framework 2 module for ZfrOAuth2Server

1236.2k1](/packages/zfr-zfr-oauth2-server-module)

PHPackages © 2026

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