PHPackages                             oneb-pub/oauth2-zoho - 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. oneb-pub/oauth2-zoho

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

oneb-pub/oauth2-zoho
====================

Zoho OAuth 2.0 Client Provider for The PHP5.6 League OAuth2-Client

0.1.0(10mo ago)01MITPHPPHP &gt;=5.6.0

Since Jul 13Pushed 10mo agoCompare

[ Source](https://github.com/oneb-pub/oauth2-zoho)[ Packagist](https://packagist.org/packages/oneb-pub/oauth2-zoho)[ Docs](https://github.com/oneb-pub/oauth2-zoho)[ RSS](/packages/oneb-pub-oauth2-zoho/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (6)Versions (2)Used By (0)

ZOHO Provider for OAuth 2.0 Client
==================================

[](#zoho-provider-for-oauth-20-client)

[![Latest Version on Packagist](https://camo.githubusercontent.com/95129b4e44a91155fba9055a9a55847dbbff67dd234da43875bfcab2fe9e5e5c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f617361642f6f61757468322d7a6f686f2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/asad/oauth2-zoho)[![Build Status](https://camo.githubusercontent.com/d577716c4d26c982e67f3d97e3f140d836e248b8f8e287f148596e83d3376a7b/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f617361646b7533342f6f61757468322d7a6f686f2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/asadku34/oauth2-zoho)[![Quality Score](https://camo.githubusercontent.com/80723a106ee5f429503ca9a95fa13a99bcf36c775ff0230024601fecedb585bf/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f617361646b7533342f6f61757468322d7a6f686f2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/asadku34/oauth2-zoho)[![Total Downloads](https://camo.githubusercontent.com/eee8583d34ffcc09ab5451c5459a8d0a215ff814772327af7315ed80d9c2bd06/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f617361642f6f61757468322d7a6f686f2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/asad/oauth2-zoho)[![License](https://camo.githubusercontent.com/850eae1099d2b05f53383473d7cd51f9bc1ab09b7d0d9e5122f1dd930efdcc6d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6d6173686170652f6170697374617475732e737667)](https://packagist.org/packages/asad/zoho-cliq)[![PHP Version](https://camo.githubusercontent.com/d39e59b8018a63143115064745a88786f93eb02d1ca1eda6c0dd2b4c776e2d37/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f617361642f6f61757468322d7a6f686f2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/asad/oauth2-zoho)

This is fork of

This package provides [ZOHO OAuth 2.0](https://www.zoho.com/crm/developer/docs/api/oauth-overview.html) support for the PHP League's [OAuth 2.0 Client](https://github.com/thephpleague/oauth2-client).

Requirements
------------

[](#requirements)

- PHP &gt;= 5.6.0
- League OAuth2 Client &gt;= 2.6

To use this package, it will be necessary to have a ZOHO client ID and client secret. These are referred to as `{zoho-client-id}` and `{zoho-client-secret}`in the documentation.

Please follow the [ZOHO instructions](https://www.zoho.com/crm/developer/docs/api/oauth-overview.html) to create the required credentials.

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

[](#installation)

You can install the package via composer:

```
composer require oneb-pub/oauth2-zoho
```

Usage
-----

[](#usage)

### Authorization Code Flow

[](#authorization-code-flow)

```
use Asad\OAuth2\Client\Provider\Zoho;

$provider = new Zoho([
    'clientId' => '{zoho-client-id}',
    'clientSecret' => '{zoho-client-secret}',
    'redirectUri' => 'http://localhost:8000/zoho/oauth2',
    'dc' => 'AU' //It will be optional if your ZOHO are in US location
]);

if (!isset($_GET['code'])) {
    // If we don't have an authorization code then get one
    $authUrl = $provider->getAuthorizationUrl([
        'scope' => [
            'ZohoCRM.modules.ALL', //Important: Define your data accessability scope here
            'ZohoCRM.settings.ALL',
        ],
        'access_type' => 'offline', //Important: If you want to generate the refresh token, set this value as offline
        'prompt' => 'consent'       //Important: Will not return a refresh token if this is not also set
    ]);

    $_SESSION['oauth2state'] = $provider->getState();
    header('Location: ' . $authUrl);
    exit;

    // Check given state against previously stored one to mitigate CSRF attack
} elseif (empty($_GET['state']) || ($_GET['state'] !== $_SESSION['oauth2state'])) {

    unset($_SESSION['oauth2state']);
    exit('Invalid state');
} else {

    // Try to get an access token (using the authorization code grant)
    try {
        $token = $provider->getAccessToken('authorization_code', [
            'code' => $_GET['code']
        ]);

        //$user = $provider->getResourceOwner($token);

        echo $access_token = $token->getToken();

        echo $refresh_token = $token->getRefreshToken(); //Save this refresh token to somewehre

        echo $token->getExpires();

    } catch (\Exception $e) {
        //handle you exception
    }
}
```

Refreshing a Token
------------------

[](#refreshing-a-token)

Refresh tokens are only provided to applications which request offline access. You can specify offline access by passing the access\_type option in your getAuthorizationUrl() request.

```
use Asad\OAuth2\Client\Provider\Zoho;
use League\OAuth2\Client\Grant\RefreshToken;

$provider = new Zoho([
    'clientId' => '{zoho-client-id}',
    'clientSecret' => '{zoho-client-secret}',
    'dc' => 'AU' //It will be optional if your ZOHO are in US location
]);

$refreshToken = 'FromYourStoredData';
$grant = new RefreshToken();
$token = $provider->getAccessToken($grant, ['refresh_token' => $refreshToken]);
```

### Testing

[](#testing)

```
composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Asadur Rahman](https://github.com/asadku34)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance54

Moderate activity, may be stable

Popularity1

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity21

Early-stage or recently created project

 Bus Factor2

2 contributors hold 50%+ of commits

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

Unknown

Total

1

Last Release

309d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/99139e5345c24635edd267522d4dd58b40782b2b1dd99b6daaad2e49f89ce20d?d=identicon)[plakidan](/maintainers/plakidan)

---

Top Contributors

[![plakidan](https://avatars.githubusercontent.com/u/18316735?v=4)](https://github.com/plakidan "plakidan (3 commits)")[![asadku34](https://avatars.githubusercontent.com/u/2770949?v=4)](https://github.com/asadku34 "asadku34 (2 commits)")[![tm1000](https://avatars.githubusercontent.com/u/564256?v=4)](https://github.com/tm1000 "tm1000 (2 commits)")[![phpfui](https://avatars.githubusercontent.com/u/7434059?v=4)](https://github.com/phpfui "phpfui (1 commits)")

---

Tags

clientoauthoauth2authorizationauthorisationZoho

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/oneb-pub-oauth2-zoho/health.svg)

```
[![Health](https://phpackages.com/badges/oneb-pub-oauth2-zoho/health.svg)](https://phpackages.com/packages/oneb-pub-oauth2-zoho)
```

###  Alternatives

[stevenmaguire/oauth2-keycloak

Keycloak OAuth 2.0 Client Provider for The PHP League OAuth2-Client

2275.9M27](/packages/stevenmaguire-oauth2-keycloak)[patrickbussmann/oauth2-apple

Sign in with Apple OAuth 2.0 Client Provider for The PHP League OAuth2-Client

1132.5M6](/packages/patrickbussmann-oauth2-apple)[mollie/oauth2-mollie-php

Mollie Provider for OAuth 2.0 Client

251.7M1](/packages/mollie-oauth2-mollie-php)[omines/oauth2-gitlab

GitLab OAuth 2.0 Client Provider for The PHP League OAuth2-Client

36721.5k13](/packages/omines-oauth2-gitlab)

PHPackages © 2026

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