PHPackages                             mrpropre/oauth2-epicgames - 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. mrpropre/oauth2-epicgames

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

mrpropre/oauth2-epicgames
=========================

Epic Games OAuth 2.0 Client Provider for The PHP League OAuth2-Client

v1.0.1(5y ago)47.1k↓32.6%1MITPHPPHP &gt;=7.3

Since Mar 26Pushed 5y ago1 watchersCompare

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

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

Epic Games Provider for OAuth 2.0 Client
========================================

[](#epic-games-provider-for-oauth-20-client)

[![Latest Stable Version](https://camo.githubusercontent.com/6f2a148dd4634da0542f5dc115aa0cd1a4b3aeaf57fe8e9d4ff5bdfd9147c848/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d7270726f7072652f6f61757468322d6570696367616d65732e737667)](https://packagist.org/packages/mrpropre/oauth2-epicgames)[![Build Status](https://camo.githubusercontent.com/5bd8cd36962c6be6774c4a3080747318443a0c76c0d9f81fad47f2fe4a309e9d/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f4d7250726f7072652f6f61757468322d6570696367616d65732e737667)](https://travis-ci.org/MrPropre/oauth2-epicgames)[![Code Coverage](https://camo.githubusercontent.com/dc532f12d625a55865f8b49ab360c67ce03d349250ab60adbdbb1b31cca17b80/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f4d7250726f7072652f6f61757468322d6570696367616d65732e737667)](https://coveralls.io/r/MrPropre/oauth2-epicgames)[![Code Quality](https://camo.githubusercontent.com/63baef217fe381f6b52d20a9a642f505e271f0e98c96b534f6cebe318a2c2619/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f4d7250726f7072652f6f61757468322d6570696367616d65732e737667)](https://scrutinizer-ci.com/g/MrPropre/oauth2-epicgames/)[![License](https://camo.githubusercontent.com/efffcac8040033a2e11599cdb7ccefe28fa1b16a4c42a090634e4a8b49bce3bb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6d7270726f7072652f6f61757468322d6570696367616d65732e737667)](LICENSE)

This package provides Epic Games OAuth 2.0 support for the PHP League's [OAuth 2.0 Client](https://github.com/thephpleague/oauth2-client).

This package is compliant with [PSR-4](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md), [PSR-7](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-7-http-message.md), and [PSR-12](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-12-extended-coding-style-guide.md). If you notice compliance oversights, please send a patch via pull request.

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

[](#installation)

To install, use composer:

```
composer require mrpropre/oauth2-epicgames

```

Requirements
------------

[](#requirements)

The following versions of PHP are supported.

- PHP 7.3
- PHP 7.4
- PHP 8.0

Usage
-----

[](#usage)

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

### Authorization Code Flow

[](#authorization-code-flow)

```
require __DIR__ . '/vendor/autoload.php';

use MrPropre\OAuth2\Client\Provider\EpicGames;
use League\OAuth2\Client\OptionProvider\HttpBasicAuthOptionProvider;

session_start(); // Remove if session.auto_start=1 in php.ini

$provider = new EpicGames([
    'clientId'          => '{epicgames-client-id}',
    'clientSecret'      => '{epicgames-client-secret}',
    'redirectUri'       => 'https://example.com/callback-url',
], [
    'optionProvider' => new HttpBasicAuthOptionProvider()
]);

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->getUsername());

    } catch (\Exception $e) {

        // Failed to get user details
        exit('Something went wrong: ' . $e->getMessage());
    }

    // Use this to interact with an API on the users behalf
    echo $token->getToken();
}
```

### Managing Scopes

[](#managing-scopes)

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

```
$options = [
    'state' => 'OPTIONAL_CUSTOM_CONFIGURED_STATE',
    'scope' => ['basic_profile','friends_list','presence'] // array or string
];

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

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

At the time of authoring this documentation, the [following scopes are available](https://dev.epicgames.com/docs/services/en-US/EpicAccountServices/GettingStarted/index.html#applicationpermissions).

- basic\_profile
- presence
- friends\_list

Testing
-------

[](#testing)

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

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

[](#contributing)

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

Credits
-------

[](#credits)

- [Adrien Alais](https://github.com/MrPropre)
- [All Contributors](https://github.com/MrPropre/oauth2-epicgames/contributors)

License
-------

[](#license)

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

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity48

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

1879d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b06e86f2f93d200fbafd492cea8e307187d5263a889c56420fe23f9b53a2a210?d=identicon)[MrPropre](/maintainers/MrPropre)

---

Top Contributors

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

---

Tags

epicgamesoauth2oauth2-clientphpclientoauthoauth2authorizationauthorisationFortniteepic gamesepicgames

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/mrpropre-oauth2-epicgames/health.svg)

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

###  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)

PHPackages © 2026

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