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

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

chadhutchins/oauth2-constantcontact
===================================

Constant Contact OAuth 2.0 Client Provider for The PHP League OAuth2-Client

1.0.3(3y ago)0206MITPHPPHP &gt;=5.5.0CI failing

Since Feb 20Pushed 3y ago1 watchersCompare

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

READMEChangelog (4)Dependencies (4)Versions (5)Used By (0)

Constant Contact Online Provider for OAuth 2.0 Client
=====================================================

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

[![Latest Stable Version](https://camo.githubusercontent.com/de010a39db2b864513ec26c8f27e8d4c4f501638b3721a150d2cde981b09ab00/68747470733a2f2f706f7365722e707567782e6f72672f636861646875746368696e732f6f61757468322d636f6e7374616e74636f6e746163742f762f737461626c65)](https://packagist.org/packages/chadhutchins/oauth2-constantcontact)[![Total Downloads](https://camo.githubusercontent.com/aba86722a72de159940689c93c5f102e7515a651c5ad7fc03e96f432693be2bb/68747470733a2f2f706f7365722e707567782e6f72672f636861646875746368696e732f6f61757468322d636f6e7374616e74636f6e746163742f646f776e6c6f616473)](https://packagist.org/packages/chadhutchins/oauth2-constantcontact)[![License](https://camo.githubusercontent.com/56b09ed4d6b75e843faa6be09a6574b79a1acfa2004f018c68ccb698f67b9bcd/68747470733a2f2f706f7365722e707567782e6f72672f636861646875746368696e732f6f61757468322d636f6e7374616e74636f6e746163742f6c6963656e7365)](https://packagist.org/packages/chadhutchins/oauth2-constantcontact)[![Build Status](https://camo.githubusercontent.com/e19aefe397c62111cfc310f060c2ebbe629737bb8e2c5cdd76f415c689be907a/68747470733a2f2f7472617669732d63692e6f72672f6d756c746964696d656e73696f6e2d616c2f6f61757468322d636f6e7374616e74636f6e746163742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/multidimension-al/oauth2-constantcontact)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/e0b98a0310862ed9060dae35b5141f6defc7bff7f92eb32f0610484aced4d955/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d756c746964696d656e73696f6e2d616c2f6f61757468322d636f6e7374616e74636f6e746163742f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/multidimension-al/oauth2-constantcontact/?branch=master)

This package provides Constant Contact 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-constantcontact

```

### Usage

[](#usage)

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

### Authorization Code Flow

[](#authorization-code-flow)

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

if (!isset($_GET['code'])) {
    $options = [
        'scope' => ['com.intuit.constantcontact.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 Constant Contact 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.constantcontact.accounting
- com.intuit.constantcontact.payment

Testing
-------

[](#testing)

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

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

[](#contributing)

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

Credits
-------

[](#credits)

- [Nile Suan](https://github.com/nilesuan)
- [All Contributors](https://github.com/chadhutchins/oauth2-constantcontact/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

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

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 ~325 days

Total

4

Last Release

1297d ago

### 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 (4 commits)")

---

Tags

clientoauthoauth2authorizationconstantcontact

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[league/oauth2-google

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

41721.2M118](/packages/league-oauth2-google)[thenetworg/oauth2-azure

Azure Active Directory OAuth 2.0 Client Provider for The PHP League OAuth2-Client

2509.6M48](/packages/thenetworg-oauth2-azure)[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)
