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

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

dts-eve/oauth2-eve
==================

EVE Online Oauth 2.0 Client Provider for The PHP League OAuth2-Client

1.0.2(4y ago)01302MITPHP

Since Feb 4Pushed 4y agoCompare

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

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

EVE Online Provider for OAuth 2.0 Client
========================================

[](#eve-online-provider-for-oauth-20-client)

FORK of

[![Source Code](https://camo.githubusercontent.com/294e5935dd0861d6d3aa1661a739a140206eec507916b87f363fe84cb7a1eede/687474703a2f2f696d672e736869656c64732e696f2f62616467652f736f757263652d6474732d6576652f6f61757468322d2d6576652d626c75652e7376673f7374796c653d666c61742d737175617265)](https://github.com/dts-eve/oauth2-eve)[![Latest Version](https://camo.githubusercontent.com/eea8617fff9f53f9801ae079fac8a7018ae1462d43a8e08aa9b0015cc5a7a7a4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f6474732d6576652f6f61757468322d6576652e7376673f7374796c653d666c61742d737175617265)](https://github.com/dts-eve/oauth2-eve/releases)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/fbc483f557de70a39d8038131228117ec9dd57d4f3f807e7c67a13d9c4bb73f9/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6474732d6576652f6f61757468322d6576652f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/dts-eve/oauth2-eve)[![Coverage Status](https://camo.githubusercontent.com/be37520e2fa90ad3c04ddd7a9c2726bfd130137da8d669e1b966878c46624530/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f6474732d6576652f6f61757468322d6576652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/dts-eve/oauth2-eve/code-structure)[![Quality Score](https://camo.githubusercontent.com/d3e4d313425a7d56b179bccf1f4301926b2c8c84c0803c89c49be590ae88022a/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6474732d6576652f6f61757468322d6576652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/dts-eve/oauth2-eve)[![Total Downloads](https://camo.githubusercontent.com/2bbb9e0833337c4cff04562f62f537d83a4df66c1f65815c0e255259c909cb44/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6474732d6576652f6f61757468322d6576652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dts-eve/oauth2-eve)

This package provides [EVE Online](https://developers.eveonline.com) 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 dts-eve/oauth2-eve

```

Usage
-----

[](#usage)

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

### Authorization Code Flow

[](#authorization-code-flow)

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

// If we don't have an authorization code then get one
if (!isset($_GET['code'])) {

    // Fetch the authorization URL from the provider; this returns the
    // urlAuthorize option and generates and applies any necessary parameters
    // (e.g. state).
    $authorizationUrl = $provider->getAuthorizationUrl();

    // Get the state generated for you and store it to the session.
    $_SESSION['oauth2state'] = $provider->getState();

    // Redirect the user to the authorization URL.
    header('Location: ' . $authorizationUrl);
    exit;

// Check given state against previously stored one to mitigate CSRF attack
} elseif (empty($_GET['state']) || (isset($_SESSION['oauth2state']) && $_GET['state'] !== $_SESSION['oauth2state'])) {

    if (isset($_SESSION['oauth2state'])) {
        unset($_SESSION['oauth2state']);
    }

    exit('Invalid state');

} else {

    try {

        // Try to get an access token using the authorization code grant.
        $accessToken = $provider->getAccessToken('authorization_code', [
            'code' => $_GET['code']
        ]);

        // We have an access token, which we may use in authenticated
        // requests against the service provider's API.
        echo 'Access Token: ' . $accessToken->getToken() . "";
        echo 'Refresh Token: ' . $accessToken->getRefreshToken() . "";
        echo 'Expired in: ' . $accessToken->getExpires() . "";
        echo 'Already expired? ' . ($accessToken->hasExpired() ? 'expired' : 'not expired') . "";

        // Using the access token, we may look up details about the
        // resource owner.
        $resourceOwner = $provider->getResourceOwner($accessToken);

        var_export($resourceOwner->toArray());

    } catch (\League\OAuth2\Client\Provider\Exception\IdentityProviderException $e) {

        // Failed to get the access token or user details.
        exit($e->getMessage());

    }

}
```

### Refreshing a Token

[](#refreshing-a-token)

Once your application is authorized, you can refresh an expired token using a refresh token rather than going through the entire process of obtaining a brand new token. To do so, simply reuse this refresh token from your data store to request a refresh.

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

$existingAccessToken = getAccessTokenFromYourDataStore();

if ($existingAccessToken->hasExpired()) {
    $newAccessToken = $provider->getAccessToken('refresh_token', [
        'refresh_token' => $existingAccessToken->getRefreshToken()
    ]);

    // Purge old access token and store new access token to your data store.
}
```

### Managing Scopes

[](#managing-scopes)

When creating your EVE Online authorization URL, you can specify the state and scopes your application may authorize.

```
$options = [
    'state' => 'OPTIONAL_CUSTOM_CONFIGURED_STATE',
    'scope' => ['esi-killmails.read_killmails.v1', 'esi-killmails.read_corporation_killmails.v1']
];

$authorizationUrl = $provider->getAuthorizationUrl($options);
```

If neither are defined, the provider will utilize internal defaults.

Use the [ESI documentation](https://esi.evetech.net/ui/) to find the full list of scopes available.

Testing
-------

[](#testing)

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

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

[](#contributing)

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

Credits
-------

[](#credits)

- [Oizys](https://github.com/syzio)
- [All Contributors](https://github.com/dts-eve/oauth2-eve/contributors)

License
-------

[](#license)

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

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 50% 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 ~349 days

Recently: every ~315 days

Total

7

Last Release

1659d ago

Major Versions

0.2.2 → 1.0.02018-05-20

### Community

Maintainers

![](https://www.gravatar.com/avatar/145f308b70870c8a9493f815d2adac1d1bd61d8e1912410fb25bd55dfb9b5846?d=identicon)[dts-eve](/maintainers/dts-eve)

---

Top Contributors

[![mostertb](https://avatars.githubusercontent.com/u/2180195?v=4)](https://github.com/mostertb "mostertb (1 commits)")[![SvenBrnn](https://avatars.githubusercontent.com/u/713150?v=4)](https://github.com/SvenBrnn "SvenBrnn (1 commits)")

---

Tags

clientoauthoauth2authorizationauthorisationEVE Onlineeveeveonline

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  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)[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)[evelabs/oauth2-eveonline

EvE Online OAuth 2.0 Client Provider for The PHP League OAuth2-Client

111.2k](/packages/evelabs-oauth2-eveonline)

PHPackages © 2026

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