PHPackages                             quadrogod/dropbox-oauth-manager - 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. quadrogod/dropbox-oauth-manager

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

quadrogod/dropbox-oauth-manager
===============================

Simple Dropbox OAuth Manager

1.0.0(1y ago)01MITPHPPHP ^7.2 || ^8.0

Since May 15Pushed 1y ago1 watchersCompare

[ Source](https://github.com/quadrogod/dropbox-oauth-manager)[ Packagist](https://packagist.org/packages/quadrogod/dropbox-oauth-manager)[ RSS](/packages/quadrogod-dropbox-oauth-manager/feed)WikiDiscussions main Synced today

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

Dropbox OAuth Manager
=====================

[](#dropbox-oauth-manager)

This is a simple PHP package for authenticating with the **Dropbox OAuth service** to obtain `access_token`, `refresh_token`, and automatically refresh the `access_token` when a valid `refresh_token` is present.

---

Install
-------

[](#install)

```
composer require quadrogod/dropbox-oauth-manager
```

---

Usage
-----

[](#usage)

```
use Quadrogod\DropboxManager\DropboxOAuthManager;

$config = [
    'client_id' => '', // App key
    'client_secret' => '', // App secret
    'redirect_uri' => '', // Your redirect URI (must be set in Dropbox App settings)
    'token_file' => __DIR__ . "/token.json", // Path to save token data
];

$dropboxManager = new DropboxOAuthManager($config);
$dropboxManager->renderLoginPage();
```

Once you receive the `CODE` from Dropbox:

```
$dropboxManager->getAndSaveToken($code);
```

This will save the token data to the default `$config['token_file']` path.

You can also use callback functions to handle and save token data according to your own logic:

```
$dropboxManager->getAndSaveToken($code, function ($token, $response) {
    var_dump($token, $response);
}, function ($response) {
    var_dump($response);
});
```

> More examples can be found in the `example` folder.

---

Example Project
---------------

[](#example-project)

The `example/` folder contains a fully working demo of how to use this package.

To simplify testing, a `Docker` environment is included. To start the example:

```
cd example && docker-compose up -d
```

or

```
docker compose up -d
```

Now you need to enter the created container and install the dependencies.

```
docker ps
docker exec -it example_php_1 bash
composer install
```

Then open  in your browser.

You must first fill in the file `example/config.env.php` with your own app credentials.

To create a Dropbox App, visit the [Dropbox Developer Console](https://www.dropbox.com/developers/) and create a new app.
Don’t forget to enable the necessary **permissions** for your app.

---

⏱ Cron Task
-----------

[](#-cron-task)

Dropbox now issues short-lived `access_token`s valid for **4 hours** to enhance account security.
You must **automatically refresh** the token before it expires.

The recommended way is to configure a `cron` job that runs hourly:

```
0 * * * * php cron.php >/dev/null 2>&1
```

This will ensure your token is always up to date.

> Note: Currently, the token data is loaded from the default file. Passing external `$tokenData` is not yet supported but will be added in future releases.

---

🧭 Roadmap
---------

[](#-roadmap)

- Refactor and improve the codebase
- Make `DropboxOAuthManager` more universal and reusable
- Improve token management logic
- Add better exception handling and logging

---

☕ Support Me
------------

[](#-support-me)

If you like this project and want to support further development:

[![Buy Me A Coffee](https://camo.githubusercontent.com/f4ab728536898716a11bdececdc1ae773f81c6efce858dd3776fef4807469880/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f2d4275792532306d6525323061253230636f666665652d2532336666646430303f6c6f676f3d6275796d6561636f66666565266c6f676f436f6c6f723d626c61636b267374796c653d666c6174)](https://buymeacoffee.com/quadrogod)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

[](#)

MIT License © Alex Molchanov

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance46

Moderate activity, may be stable

Popularity1

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity42

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

Unknown

Total

1

Last Release

414d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5109038?v=4)[quadrogod](/maintainers/quadrogod)[@quadrogod](https://github.com/quadrogod)

---

Top Contributors

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

---

Tags

phptokenoauthdropbox

### Embed Badge

![Health badge](/badges/quadrogod-dropbox-oauth-manager/health.svg)

```
[![Health](https://phpackages.com/badges/quadrogod-dropbox-oauth-manager/health.svg)](https://phpackages.com/packages/quadrogod-dropbox-oauth-manager)
```

###  Alternatives

[hwi/oauth-bundle

Support for authenticating users using both OAuth1.0a and OAuth2 in Symfony.

2.4k22.3M81](/packages/hwi-oauth-bundle)[artdarek/oauth-4-laravel

OAuth Service Provider for Laravel 4

692515.5k](/packages/artdarek-oauth-4-laravel)[and/oauth

Simple and amazing OAuth library with many providers. Just try it out!

4645.3k2](/packages/and-oauth)

PHPackages © 2026

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