Skip to content

Commit

Permalink
:octocat: rename SteamOpenID to Steam
Browse files Browse the repository at this point in the history
  • Loading branch information
codemasher committed Apr 10, 2024
1 parent 2f49fea commit bbcc14e
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 28 deletions.
8 changes: 4 additions & 4 deletions .config/.env_example
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,10 @@ SPOTIFY_CALLBACK_URL=
#SPOTIFY_TESTUSER=

# http://steamcommunity.com/dev/apikey
STEAMOPENID_KEY=
STEAMOPENID_SECRET=
STEAMOPENID_CALLBACK_URL=
#STEAMOPENID_TESTUSER=
STEAM_KEY=
STEAM_SECRET=
STEAM_CALLBACK_URL=
#STEAM_TESTUSER=

# https://dashboard.stripe.com/account/apikeys
STRIPE_KEY=
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ Note: replace `dev-main` with a [version constraint](https://getcomposer.org/doc
| [Slack](https://api.slack.com) | [link](https://api.slack.com/apps) | [link](https://slack.com/apps/manage) | 2 ||| | | | |
| [SoundCloud](https://developers.soundcloud.com/) | [link](https://soundcloud.com/you/apps) | [link](https://soundcloud.com/settings/connections) | 2 || | ||| |
| [Spotify](https://developer.spotify.com/documentation/web-api/) | [link](https://developer.spotify.com/dashboard) | [link](https://www.spotify.com/account/apps/) | 2 ||| ||| |
| [SteamOpenID](https://developer.valvesoftware.com/wiki/Steam_Web_API) | [link](https://steamcommunity.com/dev/apikey) | | - || | | | | |
| [Steam](https://developer.valvesoftware.com/wiki/Steam_Web_API) | [link](https://steamcommunity.com/dev/apikey) | | - || | | | | |
| [Stripe](https://stripe.com/docs/api) | [link](https://dashboard.stripe.com/apikeys) | [link](https://dashboard.stripe.com/account/applications) | 2 ||| | |||
| [Tumblr](https://www.tumblr.com/docs/en/api/v2) | [link](https://www.tumblr.com/oauth/apps) | [link](https://www.tumblr.com/settings/apps) | 1 || | | | | |
| [Tumblr2](https://www.tumblr.com/docs/en/api/v2) | [link](https://www.tumblr.com/oauth/apps) | [link](https://www.tumblr.com/settings/apps) | 2 ||| ||| |
Expand Down
2 changes: 1 addition & 1 deletion docs/Basics/Overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ fully [PSR-7](https://www.php-fig.org/psr/psr-7/)/[PSR-17](https://www.php-fig.o
| [Slack](https://api.slack.com) | [link](https://api.slack.com/apps) | [link](https://slack.com/apps/manage) | 2 ||| | | | |
| [SoundCloud](https://developers.soundcloud.com/) | [link](https://soundcloud.com/you/apps) | [link](https://soundcloud.com/settings/connections) | 2 || | ||| |
| [Spotify](https://developer.spotify.com/documentation/web-api/) | [link](https://developer.spotify.com/dashboard) | [link](https://www.spotify.com/account/apps/) | 2 ||| ||| |
| [SteamOpenID](https://developer.valvesoftware.com/wiki/Steam_Web_API) | [link](https://steamcommunity.com/dev/apikey) | | - || | | | | |
| [Steam](https://developer.valvesoftware.com/wiki/Steam_Web_API) | [link](https://steamcommunity.com/dev/apikey) | | - || | | | | |
| [Stripe](https://stripe.com/docs/api) | [link](https://dashboard.stripe.com/apikeys) | [link](https://dashboard.stripe.com/account/applications) | 2 ||| | |||
| [Tumblr](https://www.tumblr.com/docs/en/api/v2) | [link](https://www.tumblr.com/oauth/apps) | [link](https://www.tumblr.com/settings/apps) | 1 || | | | | |
| [Tumblr2](https://www.tumblr.com/docs/en/api/v2) | [link](https://www.tumblr.com/oauth/apps) | [link](https://www.tumblr.com/settings/apps) | 2 ||| ||| |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,15 @@
*/
declare(strict_types=1);

use chillerlan\HTTP\Utils\MessageUtil;
use chillerlan\OAuth\Providers\SteamOpenID;
use chillerlan\OAuth\Providers\Steam;

require_once __DIR__.'/../provider-example-common.php';

/**
* @var \OAuthExampleProviderFactory $factory
* @var \chillerlan\OAuth\Providers\SteamOpenID $provider
* @var \OAuthExampleProviderFactory $factory
* @var \chillerlan\OAuth\Providers\Steam $provider
*/
$provider = $factory->getProvider(SteamOpenID::class);
$provider = $factory->getProvider(Steam::class);
$name = $provider->name;

// step 2: redirect to the provider's login screen
Expand All @@ -27,7 +26,7 @@
}
// step 3: receive the access token
elseif(isset($_GET['openid_sig']) && isset($_GET['openid_signed'])){
// the SteamOpenID provider takes the whole $_GET array as it uses multiple of the query parameters
// the Steam provider takes the whole $_GET array as it uses multiple of the query parameters
$token = $provider->getAccessToken($_GET);

// save the token [...]
Expand All @@ -45,9 +44,8 @@
// use the file storage from now on
$provider->setStorage($factory->getFileStorage());

$data = $provider->me();
$token = $provider->getAccessTokenFromStorage(); // the user's steamid is stored as access token
$response = $provider->request('/ISteamUser/GetPlayerSummaries/v2', ['steamids' => $token->accessToken]);
$data = print_r(MessageUtil::decodeJSON($response), true);
$tokenJSON = $token->toJSON();

printf('<pre>%s</pre><textarea cols="120" rows="5" onclick="this.select();">%s</textarea>', $data, $tokenJSON);
Expand Down
6 changes: 3 additions & 3 deletions src/Providers/SteamOpenID.php → src/Providers/Steam.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Class SteamOpenID
* Class Steam
*
* @created 15.03.2021
* @author smiley <[email protected]>
Expand All @@ -24,9 +24,9 @@
* @see https://partner.steamgames.com/doc/webapi_overview
* @see https://steamwebapi.azurewebsites.net/
*/
class SteamOpenID extends OAuthProvider implements UserInfo{
class Steam extends OAuthProvider implements UserInfo{

public const IDENTIFIER = 'STEAMOPENID';
public const IDENTIFIER = 'STEAM';

protected string $authorizationURL = 'https://steamcommunity.com/openid/login';
protected string $accessTokenURL = 'https://steamcommunity.com/openid/login';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Class SteamOpenIDAPITest
* Class SteamAPITest
*
* @created 15.03.2021
* @author smiley <[email protected]>
Expand All @@ -12,19 +12,19 @@
namespace chillerlan\OAuthTest\Providers\Live;

use chillerlan\OAuth\Core\AuthenticatedUser;
use chillerlan\OAuth\Providers\SteamOpenID;
use chillerlan\OAuth\Providers\Steam;
use PHPUnit\Framework\Attributes\Group;

/**
* @property \chillerlan\OAuth\Providers\SteamOpenID $provider
* @property \chillerlan\OAuth\Providers\Steam $provider
*/
#[Group('providerLiveTest')]
final class SteamOpenIDAPITest extends OAuthProviderLiveTestAbstract{
final class SteamAPITest extends OAuthProviderLiveTestAbstract{

protected int $id;

protected function getProviderFQCN():string{
return SteamOpenID::class;
return Steam::class;
}

protected function setUp():void{
Expand All @@ -40,7 +40,6 @@ public function testUnauthorizedAccessException():void{
}

protected function assertMeResponse(AuthenticatedUser $user):void{
var_dump($user);
$this::assertSame((int)$this->TEST_USER, $user->id);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Class SteamOpenIDTest
* Class SteamTest
*
* @created 15.03.2021
* @author smiley <[email protected]>
Expand All @@ -11,15 +11,15 @@

namespace chillerlan\OAuthTest\Providers\Unit;

use chillerlan\OAuth\Providers\SteamOpenID;
use chillerlan\OAuth\Providers\Steam;

/**
* @property \chillerlan\OAuth\Providers\SteamOpenID $provider
* @property \chillerlan\OAuth\Providers\Steam $provider
*/
final class SteamOpenIDTest extends OAuthProviderUnitTestAbstract{
final class SteamTest extends OAuthProviderUnitTestAbstract{

protected function getProviderFQCN():string{
return SteamOpenID::class;
return Steam::class;
}

public function testMeUnknownErrorException():void{
Expand Down

0 comments on commit bbcc14e

Please sign in to comment.