PHPackages                             relictos/oauth2-bnet - 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. relictos/oauth2-bnet

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

relictos/oauth2-bnet
====================

A Battle.net provider for league/oauth2-client

1.0(10y ago)085MITPHPPHP &gt;=5.5.0

Since May 12Pushed 10y ago1 watchersCompare

[ Source](https://github.com/relictos/oauth-bnet)[ Packagist](https://packagist.org/packages/relictos/oauth2-bnet)[ RSS](/packages/relictos-oauth2-bnet/feed)WikiDiscussions master Synced 3w ago

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

Battle.net provider for league/oauth2-client
============================================

[](#battlenet-provider-for-leagueoauth2-client)

This is a package to integrate Battle.net authentication with the OAuth2 client library by [The League of Extraordinary Packages](https://github.com/thephpleague/oauth2-client).

Currently integrated with OAuth to pull profiles from SC2 &amp; WoW. If Diablo players submit a PR, I'd be happy to merge in changes and be inclusive :) Thanks to [@TheJaydox](https://github.com/TheJaydox)for submitting a WoW pull!

To install, use composer:

```
composer require depotwarehouse/oauth2-bnet
```

Usage is the same as the league's OAuth client, using `\Depotwarehouse\OAuth2\Client\Provider\SC2Provider` or `\Depotwarehouse\OAuth2\Client\Provider\WowProvider` as the provider. For example:

```
$provider = new \Depotwarehouse\OAuth2\Client\Provider\SC2Provider([
    'clientId' => "YOUR_CLIENT_ID",
    'clientSecret' => "YOUR_CLIENT_SECRET",
    'redirectUri' => "http://your-redirect-uri",
    'region' => 'eu'
]);
```

As you can see you may pass an optional 'region' argument to the constructor, and it will then query on that region instead. If you omit the region argument, then it will default to the `us` region.

```
if (isset($_GET['code']) && $_GET['code']) {
    $token = $this->provider->getAccessToken("authorizaton_code", [
        'code' => $_GET['code']
    ]);

    // Returns an instance of Depotwarehouse\OAuth2\Client\Entity\SC2User
    $user = $this->provider->getResourceOwner($token);
```

To get to know the data available on an `SC2User` simply inspect the public properties of the class, as they show all the available data that has been returned.

Alternatively, for WoW you can use `\Depotwarehouse\OAuth2\Client\Provider\WowProvider` and it will return an object of type `WowUser`. A `WowUser` simply contains a public `$data` property with an array of character objects as `stdClass`s.

There's an example JSON representation below, but I suggest you use inspection to figure out more closely what you're looking for (and maybe send a pull request with the properties you find!)

Example output (converted to JSON for display):

```
// $user->
{
    "data": [
    {
        "name": "Thejaydox",
        "realm": "Stormreaver",
        "battlegroup": "Rampage",
        "class": 4,
        "race": 10,
        "gender": 1,
        "level": 88,
        "achievementPoints": 16330,
        "thumbnail": "stormreaver\/230\/89809638-avatar.jpg",
        "spec": {
            "name": "Assassination",
            "role": "DPS",
            "backgroundImage": "bg-rogue-assassination",
            "icon": "ability_rogue_eviscerate",
            "description": "A deadly master of poisons who dispatches victims with vicious dagger strikes.",
            "order": 0
        },
        "guild": "Honnouji Academy",
        "guildRealm": "Stormreaver",
        "lastModified": 1421373438000
    },
    ]
}
```

Testing
-------

[](#testing)

There is a simple scaffold for an integration test in `test/`. Unfortunately, it is nontrivial to use, as the Battle.net OAuth service *requires* the use of `https` for all authentication traffic (but that does bode well for security!)

Included is an SSL certificate as well as a private key for use with the domain `oauth2-bnet.local`. Simply add `oauth2-bnet.local`to your `/etc/hosts` as an alias for localhost, and configure apache to serve the files in `test/` using the certificate and key files in `test/ssl`.

Next edit `test/config.php` to fill in the values for your own client key from  and you should be able to run the test. The page should redirect you to log in, and then dump your user values to screen if successful.

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

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

3700d ago

### Community

Maintainers

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

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/relictos-oauth2-bnet/health.svg)

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

###  Alternatives

[spatie/laravel-permission

Permission handling for Laravel 12 and up

12.9k98.0M1.3k](/packages/spatie-laravel-permission)[illuminate/auth

The Illuminate Auth package.

9327.9M1.2k](/packages/illuminate-auth)[spatie/laravel-passkeys

Use passkeys in your Laravel app

471755.5k32](/packages/spatie-laravel-passkeys)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3913.7k](/packages/rawilk-profile-filament-plugin)[masterix21/laravel-licensing

Laravel licensing package with polymorphic assignment to any model, activation keys, expirations/renewals, and seat control via LicenseUsage. Supports offline verification with public-key–signed tokens, a CLI to generate/rotate/revoke keys, and an extensible architecture via config and contracts.

1542.1k4](/packages/masterix21-laravel-licensing)[alajusticia/laravel-logins

Session management in Laravel apps, user notifications on new access, support for multiple separate remember tokens, IP geolocation, User-Agent parser

2013.2k](/packages/alajusticia-laravel-logins)

PHPackages © 2026

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