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

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

andyhartley/oauth2-instagram
============================

Extended Instagram OAuth 2.0 Client Provider for The PHP League's OAuth2 Client

v1.0.0(5y ago)0113MITPHP

Since Mar 1Pushed 5y ago1 watchersCompare

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

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

Extended Instagram Provider for OAuth 2.0 Client
================================================

[](#extended-instagram-provider-for-oauth-20-client)

This extends the official [The PHP League Instagram provider](https://github.com/thephpleague/oauth2-instagram) for the OAuth 2.0 Client. The official provider allows a user to authenticate with OAuth to get a code, and exchange that for a *short lived* token to access the Instagram API, but this only lasts around an hour and can't be renewed for another short lived token. However, Instagram allows you to [swap that short lived token for a *long lived* token](https://developers.facebook.com/docs/instagram-basic-display-api/guides/long-lived-access-tokens#get-a-long-lived-token) (up to 60 days), and renew that token for as long as you have permissions for that user.

This package extends the provider with new methods, first to swap a short lived token for a long lived one, and second to renew that long lived token.

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

[](#installation)

To install, use composer:

```
composer require andyhartley/oauth2-instagram

```

Usage
-----

[](#usage)

Usage is the same as The League's OAuth client, using `\Hartley\OAuth2\Client\Provider\Instagram` as the provider. If you're already using the official provider then you can simply swap the namespace as required.

The additional methods can be called as follows, where `$provider` is this provider, and `$accessToken` is a League `AccessTokenInterface`;

Getting a *long lived* Instagram user token from a *short lived* Instagram user token.

```
$newAccessToken = $provider->getLongLivedToken([
    'access_token' => $accessToken->getToken(), // this must be a short lived token
]);
```

Refreshing a *long lived* Instagram user token from a current *long lived* Instagram user token.

```
$newAccessToken = $provider->refreshLongLivedToken([
    'access_token' => $accessToken->getToken(), // this must be a long lived token that is older than 1 day, and no older than 60 days
]);
```

License
-------

[](#license)

The MIT License (MIT). The licence is included in this package.

Feedback Welcome
----------------

[](#feedback-welcome)

Whilst I've been a professional developer for a decade, this is my first public package. All comments and feedback are welcome.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

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

Total

2

Last Release

1901d ago

Major Versions

v0.0.1-beta → v1.0.02021-03-01

### Community

Maintainers

![](https://www.gravatar.com/avatar/15e85787153c51828ff7b8f5c57088011f5abe016544d4156eb7f0ddf2fef8e0?d=identicon)[andyhartley](/maintainers/andyhartley)

---

Top Contributors

[![andyhartley](https://avatars.githubusercontent.com/u/11887408?v=4)](https://github.com/andyhartley "andyhartley (8 commits)")

---

Tags

clientinstagramoauthoauth2authorizationauthorisation

### Embed Badge

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

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

###  Alternatives

[league/oauth2-instagram

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

761.0M31](/packages/league-oauth2-instagram)[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)
