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

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

intercom/oauth2-intercom
========================

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

2.0.1(6y ago)6184.3k↓49.7%6[1 issues](https://github.com/intercom/oauth2-intercom/issues)[1 PRs](https://github.com/intercom/oauth2-intercom/pulls)Apache-2.0PHPPHP ^5.6|^7.0CI failing

Since Sep 7Pushed 3y ago148 watchersCompare

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

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

Intercom Provider for OAuth 2.0 Client
======================================

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

[![Build Status](https://camo.githubusercontent.com/e78bf8fe175dd86d76aaa34e3dd3c68334db4616031f07b06bcdafacd93bfe46/68747470733a2f2f7472617669732d63692e6f72672f696e746572636f6d2f6f61757468322d696e746572636f6d2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/intercom/oauth2-intercom)

This package provides Intercom 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 intercom/oauth2-intercom

```

Usage
-----

[](#usage)

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

### Authorization Code Flow

[](#authorization-code-flow)

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

if (!isset($_GET['code'])) {

    // If we don't have an authorization code then get one
    $authUrl = $provider->getAuthorizationUrl();
    $_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 {

    // Get access token using the authorization code grant
    $token = $provider->getAccessToken('authorization_code', [
        'code' => $_GET['code']
    ]);

    // Optional: Now you have 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) {

        exit('Failed to get user details');
    }

    echo $token;

}
```

By default Intercom provider rejects users with unverified email addresses. User info will not be populated in that case. To disable this check add verifyEmail set to false to your config:

```
$provider = new Intercom\OAuth2\Client\Provider\Intercom([
    'clientId'          => '{intercom-client-id}',
    'clientSecret'      => '{intercom-client-secret}',
    'redirectUri'       => 'https://example.com/callback-url',
    'verifyEmail'       => false
]);
```

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

[](#refreshing-a-token)

Intercom's OAuth implementation does not use refresh tokens. Access tokens are valid until a user revokes access manually, or until an app deauthorizes itself.

Testing
-------

[](#testing)

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

License
-------

[](#license)

The Apache 2 License. Please see [License File](https://github.com/intercom/oauth2-intercom/blob/master/LICENSE) for more information.

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity37

Limited adoption so far

Community24

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor3

3 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

Every ~308 days

Total

5

Last Release

2353d ago

Major Versions

1.0.2 → 2.0.02018-10-11

PHP version history (2 changes)1.0.0PHP &gt;=5.5.0

2.0.0PHP ^5.6|^7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/3e4fc16ff48a7f354c2299be2e6a44c9b0863e9b2512a8a78a39b1b71a9e4c3c?d=identicon)[team-dp+dev](/maintainers/team-dp+dev)

---

Top Contributors

[![mmartinic](https://avatars.githubusercontent.com/u/1299531?v=4)](https://github.com/mmartinic "mmartinic (4 commits)")[![enrico-intercom](https://avatars.githubusercontent.com/u/85943894?v=4)](https://github.com/enrico-intercom "enrico-intercom (2 commits)")[![fox](https://avatars.githubusercontent.com/u/62379?v=4)](https://github.com/fox "fox (2 commits)")[![dannyfallon](https://avatars.githubusercontent.com/u/1104475?v=4)](https://github.com/dannyfallon "dannyfallon (2 commits)")[![GabrielAnca](https://avatars.githubusercontent.com/u/251391?v=4)](https://github.com/GabrielAnca "GabrielAnca (1 commits)")[![mattdonnelly](https://avatars.githubusercontent.com/u/342412?v=4)](https://github.com/mattdonnelly "mattdonnelly (1 commits)")[![OskarStark](https://avatars.githubusercontent.com/u/995707?v=4)](https://github.com/OskarStark "OskarStark (1 commits)")

---

Tags

clientoauthoauth2authorizationauthorisationintercom

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[stevenmaguire/oauth2-keycloak

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

2306.4M45](/packages/stevenmaguire-oauth2-keycloak)[thenetworg/oauth2-azure

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

25310.7M83](/packages/thenetworg-oauth2-azure)[patrickbussmann/oauth2-apple

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

1152.8M12](/packages/patrickbussmann-oauth2-apple)[omines/oauth2-gitlab

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

36779.2k16](/packages/omines-oauth2-gitlab)[league/oauth2-instagram

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

661.1M48](/packages/league-oauth2-instagram)[mollie/oauth2-mollie-php

Mollie Provider for OAuth 2.0 Client

261.8M1](/packages/mollie-oauth2-mollie-php)

PHPackages © 2026

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