Skip to content

Commit

Permalink
Steam Provider - fix config key and problem with userFromToken() (#563)
Browse files Browse the repository at this point in the history
Co-authored-by: atymic <[email protected]>
  • Loading branch information
michaloravec and atymic authored Oct 22, 2020
1 parent 970a679 commit 1e20616
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,17 +105,17 @@ protected function parseAccessToken($body)
*/
protected function getUserByToken($token)
{
if (is_null($this->steamId)) {
if (is_null($token)) {
return null;
}

if (empty($this->getConfig('api_key'))) {
if (empty($this->getConfig('client_secret'))) {
throw new RuntimeException('The Steam API key has not been specified.');
}

$response = $this->getHttpClient()->request(
'GET',
sprintf(self::STEAM_INFO_URL, $this->getConfig('api_key'), $this->steamId)
sprintf(self::STEAM_INFO_URL, $this->getConfig('client_secret'), $token)
);

$contents = json_decode($response->getBody()->getContents(), true);
Expand Down Expand Up @@ -298,6 +298,6 @@ protected function getTokenUrl()

public static function additionalConfigKeys()
{
return ['api_key', 'realm', 'https', 'proxy'];
return ['client_secret', 'realm', 'https', 'proxy'];
}
}
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ Please see the [Base Installation Guide](https://socialiteproviders.com/usage/),
### Add configuration to `config/services.php`

```php
'steam' => [
'client_id' => env('STEAM_CLIENT_ID'),
'client_secret' => env('STEAM_CLIENT_SECRET'),
'redirect' => env('STEAM_REDIRECT_URI')
'steam' => [
'client_id' => null,
'client_secret' => env('STEAM_CLIENT_SECRET'),
'redirect' => env('STEAM_REDIRECT_URI')
],
```

Expand Down

0 comments on commit 1e20616

Please sign in to comment.