PHPackages                             chadhutchins/oauth2-quickbooks - 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. chadhutchins/oauth2-quickbooks

ActiveLibrary

chadhutchins/oauth2-quickbooks
==============================

Quickbooks Online OAuth 2.0 Client Provider for The PHP League OAuth2-Client

06.3k↓50%2[1 issues](https://github.com/chadhutchins/oauth2-quickbooks/issues)PHPCI failing

Since Nov 8Pushed 6y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Quickbooks Online Provider for OAuth 2.0 Client
===============================================

[](#quickbooks-online-provider-for-oauth-20-client)

[![Latest Stable Version](https://camo.githubusercontent.com/e4ad4e16278b00a678664aaf92bf2a86057d802d8c6ac2e2f0a64fda7a449b2b/68747470733a2f2f706f7365722e707567782e6f72672f636861646875746368696e732f6f61757468322d717569636b626f6f6b732f762f737461626c65)](https://packagist.org/packages/chadhutchins/oauth2-quickbooks)[![Total Downloads](https://camo.githubusercontent.com/b6d4f76441e477a0e19cf24db087445c903bfe3a001a71fe910e2a8f7b2791de/68747470733a2f2f706f7365722e707567782e6f72672f636861646875746368696e732f6f61757468322d717569636b626f6f6b732f646f776e6c6f616473)](https://packagist.org/packages/chadhutchins/oauth2-quickbooks)[![License](https://camo.githubusercontent.com/f3ab2a8dc421e675cafc0fa5ff0e979c5c2c7548016ab68e546bfc723bc67797/68747470733a2f2f706f7365722e707567782e6f72672f636861646875746368696e732f6f61757468322d717569636b626f6f6b732f6c6963656e7365)](https://packagist.org/packages/chadhutchins/oauth2-quickbooks)[![Build Status](https://camo.githubusercontent.com/e54885202971e8ec566e6b2606f63f58f1efb6e407a2202f1372f29650754d92/68747470733a2f2f7472617669732d63692e6f72672f6d756c746964696d656e73696f6e2d616c2f6f61757468322d717569636b626f6f6b732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/multidimension-al/oauth2-quickbooks)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/6f56c7dce08993aa46790109927c2a353c016e40feba630a1a9297d90bb2259f/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d756c746964696d656e73696f6e2d616c2f6f61757468322d717569636b626f6f6b732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/multidimension-al/oauth2-quickbooks/?branch=master)

This package provides Quickbooks Online's OAuth 2.0 support for the PHP League's [OAuth 2.0 Client](https://github.com/thephpleague/oauth2-client).

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

[](#installation)

To install, use composer:

```
composer require chadhutchins/oauth2-quickbooks

```

### Usage

[](#usage)

Usage is the same as The League's OAuth client, using `\Chadhutchins\OAuth2\Client\Provider\Quickbooks` as the provider.

### Authorization Code Flow

[](#authorization-code-flow)

```
$provider = new Chadhutchins\OAuth2\Client\Provider\Quickbooks([
    'clientId'          => '{quickbooks-app-id}',
    'clientSecret'      => '{quickbooks-app-secret}',
    'redirectUri'       => 'https://example.com/callback-url',
]);

if (!isset($_GET['code'])) {
    $options = [
        'scope' => ['com.intuit.quickbooks.accounting'] // array or string
    ];

    // If we don't have an authorization code then get one
    $authUrl = $provider->getAuthorizationUrl($options);
    $_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)
    $token = $provider->getAccessToken('authorization_code', [
        'code' => $_GET['code']
    ]);

    // Optional: Now you have a token you can look up a users profile data
    try {

        // We got an access token, let's now get the user's details
        $user = $provider->getResourceOwner($token);

        // Use these details to create a new profile
        printf('Hello %s!', $user->getName());

    } catch (Exception $e) {

        // Failed to get user details
        exit('Oh dear...');
    }

    // Use this to interact with an API on the users behalf
    echo $token->getToken();
}
```

### Managing Scopes

[](#managing-scopes)

When creating your Quickbooks Online authorization URL, you can specify the state and scopes your application may authorize.

```
$options = [
    'state' => 'OPTIONAL_CUSTOM_CONFIGURED_STATE',
    'scope' => ['read_orders','write_orders'] // array or string
];

$authorizationUrl = $provider->getAuthorizationUrl($options);
```

If neither are defined, the provider will utilize internal defaults.

At the time of authoring this documentation, the [following scopes are available](https://developer.intuit.com/app/developer/qbo/docs/develop/authentication-and-authorization/oauth-2.0).

- com.intuit.quickbooks.accounting
- com.intuit.quickbooks.payment

Testing
-------

[](#testing)

```
$ ./vendor/bin/phpunit
```

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

[](#contributing)

Please see [CONTRIBUTING](https://github.com/chadhutchins/oauth2-quickbooks/blob/master/CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

- [Nile Suan](https://github.com/nilesuan)
- [All Contributors](https://github.com/chadhutchins/oauth2-quickbooks/contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](https://github.com/multidimension-al/oauth2-shopify/blob/master/LICENSE) for more information.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 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/c22d34631d930cec68e9073570d01ee28e6afd23e19046ab936b3612d9304125?d=identicon)[chadhutchins](/maintainers/chadhutchins)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/chadhutchins-oauth2-quickbooks/health.svg)

```
[![Health](https://phpackages.com/badges/chadhutchins-oauth2-quickbooks/health.svg)](https://phpackages.com/packages/chadhutchins-oauth2-quickbooks)
```

PHPackages © 2026

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