invisnik / laravel-steam-auth

Laravel Steam Auth
MIT License
172 stars 67 forks source link

[steam->validate()] keeps returning false because of [HTTP/1.0 403 Forbidden] #28

Closed Mahmoudz closed 8 years ago

Mahmoudz commented 8 years ago

First I like this package, it looks very nice.

I did everything as mentioned in the docs. But I always get False when validating the steam response. Due to the following error:

ErrorException: local.ERROR: ErrorException: file_get_contents(http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=5D3493723667BZ6963CDSD86E7D40E&steamids=76561198232252756): failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden
 in /var/www/laravel/vendor/invisnik/laravel-steam-auth/src/SteamAuth.php:148

Here's how my code looks like:

steam-auth config:

return [
    'redirect_url' => '/auth/steam/return',
    'api_key' => '2D3493123767BD6963CD6DD86E7D10S'; // env('STEAM_KEY', ''),
    'https' => false
];

routes:

$router->any('/auth/steam/', [
    'uses' => 'SteamAuthenticationController@redirect',
]);

$router->any('/auth/steam/return', [
    'uses' => 'SteamAuthenticationController@return',
]);

SteamAuthenticationController:

<?php
use App\Containers\User\Models\User;
use App\Kernel\Controller\Abstracts\ApiController;
use Auth;
use Invisnik\LaravelSteamAuth\SteamAuth;

class SteamAuthenticationController extends ApiController
{
    private $steam;

    public function __construct(SteamAuth $steam)
    {
        $this->steam = $steam;
    }

    public function redirect()
    {
        // Go to Steam login page
        return $this->steam->redirect();
    }

    public function return()
    {
        if ($this->steam->validate()) {

            $info = $this->steam->getUserInfo();

            if (!is_null($info)) {

                  dd($info);

//                $user = User::where('steamid', $info->getSteamID64())->first();
//
//                if (is_null($user)) {
//
//                    $user = User::create([
//                        'username' => $info->getNick(),
//                        'avatar'   => $info->getProfilePictureFull(),
//                        'steamid'  => $info->getSteamID64()
//                    ]);
//
//                }
//
//                Auth::login($user, true);
            }
        }

        dd('something went wrong!!');

    }

}
Mahmoudz commented 8 years ago

So wired!!! I just Revoked my Steam Web API Key and it worked just fine.