invisnik / laravel-steam-auth

Laravel Steam Auth
MIT License
172 stars 67 forks source link

I only get steamid, call getUserInfo() is empty? #33

Closed robincodex closed 8 years ago

robincodex commented 8 years ago

Hello,I don't know why the login is successful but get user info is empty.

private $steam;

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

public function login()
{
    if ($this->steam->validate()) {
        $info = $this->steam->getUserInfo();
        if (!is_null($info)) {
            $user = User::where('steamid', $info->getSteamID64())->first();
            if (is_null($user)) {
                $user = User::create([
                    'username' => $info->getNick(),
                    'avatar'   => $info->getProfilePictureFull(),
                    'steamid'  => $info->getSteamID64()
                ]);
                Log::info("steamid:".$this->steam->getSteamId());
                Log::info("parseInfo:".$this->steam->parseInfo());
                Log::info("getUserInfo:".json_encode($this->steam->getUserInfo()));
                Log::info("getAuthUrl:".$this->steam->getAuthUrl());
            }
            Auth::login($user, true);
            return redirect('/'); // redirect to site
        }
    }
    return $this->steam->redirect(); // redirect to Steam login page
}

the log output:

[2016-08-04 22:38:15] local.INFO: steamid:76561198095715299  
[2016-08-04 22:38:15] local.INFO: parseInfo:  
[2016-08-04 22:38:15] local.INFO: getUserInfo:{}  
[2016-08-04 22:38:15] local.INFO: getAuthUrl:

my mysql image

robincodex commented 8 years ago

Ok, this is my problem.