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

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

slacker775/oauth2-sharefile
===========================

ShareFile OAuth 2.0 Client Provider for the PHP League OAuth2-Client

1.0.3(6y ago)018.9k↓45.8%GPL-3.0-or-laterPHP

Since Apr 23Pushed 6y ago1 watchersCompare

[ Source](https://github.com/slacker775/oauth2-sharefile)[ Packagist](https://packagist.org/packages/slacker775/oauth2-sharefile)[ RSS](/packages/slacker775-oauth2-sharefile/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (4)Versions (6)Used By (0)

ShareFile Provider for OAuth 2.0 Client
=======================================

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

[![Latest Version](https://camo.githubusercontent.com/4817a083e93c2e6a3c727d93fa2791bb687dfeae118530734ccb030b23283e06/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f73746576656e6d6167756972652f6f61757468322d626f782e7376673f7374796c653d666c61742d737175617265)](https://github.com/stevenmaguire/oauth2-box/releases)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/0a0db09df64df49fd608e6e4f8a7daac3ce88be620b72ba47cc142c3f8a5d818/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f73746576656e6d6167756972652f6f61757468322d626f782f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/stevenmaguire/oauth2-box)[![Coverage Status](https://camo.githubusercontent.com/f176c49bfcd3aa73915abe8adefc8508a5b2ae26c03ee26970942d392ceb53b3/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f73746576656e6d6167756972652f6f61757468322d626f782e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/stevenmaguire/oauth2-box/code-structure)[![Quality Score](https://camo.githubusercontent.com/71110d25e7f4e8ea8cf26ce115ba82b00a5bd5e86b58f21e05148054b762dadf/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f73746576656e6d6167756972652f6f61757468322d626f782e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/stevenmaguire/oauth2-box)[![Total Downloads](https://camo.githubusercontent.com/fa0b74645758e997dec995b36d311ddc1443e0f171834f19ca884f3d652c20f8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73746576656e6d6167756972652f6f61757468322d626f782e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/stevenmaguire/oauth2-box)

This package provides ShareFile 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 slacker775/oauth2-sharefile

```

Usage
-----

[](#usage)

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

### Authorization Code Flow

[](#authorization-code-flow)

```
    $options = [
        'clientId' => 'xxxxxxxxxxxxxxxxx',
        'clientSecret' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
    ];

    $provider = new Fpdr\OAuth2\Client\Provider\ShareFile($options);

    $accessToken = $provider->getAccessToken('password', [
        'username' => 'jsmith@example.com',
        'password' => 'XXXXXXXXXXXXXXXXXXXXX',
        'baseurl' => 'example.sharefile.com'
    ]);

    $url = sprintf('https://%s.sf-api.com/sf/v3/Items(home)', $accessToken->getValues()['subdomain']);
    $request = $provider->getAuthenticatedRequest('GET', $url, $accessToken);

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

Testing
-------

[](#testing)

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

Credits
-------

[](#credits)

- [David Hollis](https://github.com/slacker775)

License
-------

[](#license)

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

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity67

Established project with proven stability

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

Total

4

Last Release

2474d ago

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

oauthoauth2sharefile

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[thenetworg/oauth2-azure

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

25310.7M83](/packages/thenetworg-oauth2-azure)[league/oauth2-google

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

42223.4M176](/packages/league-oauth2-google)[stevenmaguire/oauth2-keycloak

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

2306.4M45](/packages/stevenmaguire-oauth2-keycloak)[knpuniversity/oauth2-client-bundle

Integration with league/oauth2-client to provide services

84318.3M84](/packages/knpuniversity-oauth2-client-bundle)[league/oauth2-facebook

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

32013.9M86](/packages/league-oauth2-facebook)[patrickbussmann/oauth2-apple

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

1152.8M12](/packages/patrickbussmann-oauth2-apple)

PHPackages © 2026

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