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

Abandoned → [stevenmaguire/oauth2-dropbox](/?search=stevenmaguire%2Foauth2-dropbox)Library[Authentication &amp; Authorization](/categories/authentication)

pixelfear/oauth2-dropbox
========================

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

3.1.0(4y ago)164.8k16[1 PRs](https://github.com/pixelfear/oauth2-dropbox/pulls)1MITPHP

Since Feb 12Pushed 1y ago3 watchersCompare

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

READMEChangelog (6)Dependencies (4)Versions (9)Used By (1)

Dropbox Provider for OAuth 2.0 Client
=====================================

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

[![Latest Version](https://camo.githubusercontent.com/7494a18882919b09c357f28c5f08fdb15f87134b19c06a997c79f29ca218b282/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f73746576656e6d6167756972652f6f61757468322d64726f70626f782e7376673f7374796c653d666c61742d737175617265)](https://github.com/stevenmaguire/oauth2-dropbox/releases)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/55f75cfc696c78b0bfeb509db15fd87b60713e7e4e897f13335e27d1979fe99d/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f73746576656e6d6167756972652f6f61757468322d64726f70626f782f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://app.travis-ci.com/github/stevenmaguire/oauth2-dropbox)[![Coverage Status](https://camo.githubusercontent.com/71ab7ae0a70027abf586059d245b024cccaa85333b6c34694d45a4133f28f2de/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f73746576656e6d6167756972652f6f61757468322d64726f70626f782e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/stevenmaguire/oauth2-dropbox/code-structure)[![Quality Score](https://camo.githubusercontent.com/1739031e134ce4189675c39828d3bd0ace1d8a253fdbbb9690b71e79082f874f/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f73746576656e6d6167756972652f6f61757468322d64726f70626f782e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/stevenmaguire/oauth2-dropbox)[![Total Downloads](https://camo.githubusercontent.com/5e0ac3fe1f054f3ac3f852c33d788e353211c0855fccabaa2fdad3e78a182f13/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73746576656e6d6167756972652f6f61757468322d64726f70626f782e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/stevenmaguire/oauth2-dropbox)

This package provides Dropbox 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 stevenmaguire/oauth2-dropbox

```

**Note:** Due API deprecation, we dropped support to Dropbox API v1. If you need use v1, please use `^2.0.0` version constraint:

```
composer require "stevenmaguire/oauth2-dropbox:^2.0.0"

```

Usage
-----

[](#usage)

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

### Authorization Code Flow

[](#authorization-code-flow)

```
$provider = new Stevenmaguire\OAuth2\Client\Provider\Dropbox([
    'clientId'          => '{dropbox-client-id}',
    'clientSecret'      => '{dropbox-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 {

    // 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->getId());

    } 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();
}
```

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

[](#refreshing-a-token)

Dropbox'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
```

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

[](#contributing)

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

Credits
-------

[](#credits)

- [Steven Maguire](https://github.com/stevenmaguire)
- [All Contributors](https://github.com/stevenmaguire/oauth2-dropbox/contributors)

License
-------

[](#license)

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

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance29

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 51% 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 ~344 days

Recently: every ~421 days

Total

8

Last Release

1699d ago

Major Versions

0.1.1 → 1.02016-08-01

1.x-dev → 2.0.02017-02-03

2.0.0 → 3.0.02017-07-13

PHP version history (2 changes)0.1.0PHP &gt;=5.4.0

1.0PHP &gt;=5.5.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/9438fee7f6e8c043056c273ed3e445c9d92c525e91604b425d5df2d26cbca517?d=identicon)[pixelfear](/maintainers/pixelfear)

---

Top Contributors

[![stevenmaguire](https://avatars.githubusercontent.com/u/1851973?v=4)](https://github.com/stevenmaguire "stevenmaguire (26 commits)")[![jasonvarga](https://avatars.githubusercontent.com/u/105211?v=4)](https://github.com/jasonvarga "jasonvarga (11 commits)")[![iget-esoares](https://avatars.githubusercontent.com/u/9450290?v=4)](https://github.com/iget-esoares "iget-esoares (10 commits)")[![jamesfairhurst](https://avatars.githubusercontent.com/u/230768?v=4)](https://github.com/jamesfairhurst "jamesfairhurst (2 commits)")[![gvso](https://avatars.githubusercontent.com/u/2955158?v=4)](https://github.com/gvso "gvso (1 commits)")[![josiasmontag](https://avatars.githubusercontent.com/u/1945577?v=4)](https://github.com/josiasmontag "josiasmontag (1 commits)")

---

Tags

clientoauthoauth2authorizationauthorisationdropbox

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  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)[stevenmaguire/oauth2-dropbox

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

16561.4k2](/packages/stevenmaguire-oauth2-dropbox)[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)
