@foggus

Проблема с авторизацией Steam на сайте laravel?

Привет, очень долго уже мучаюсь с непонятной проблемой авторизации на сайте.
Сайт на laravel, php, js, не знаю в чем проблема вовремя авторизации выдает:
http://185.246.65.205/auth/login?openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.mode=id_res&openid.op_endpoint=https%3A%2F%2Fsteamcommunity.com%2Fopenid%2Flogin&openid.claimed_id=https%3A%2F%2Fsteamcommunity.com%2Fopenid%2Fid%2F76561198824025938&openid.identity=https%3A%2F%2Fsteamcommunity.com%2Fopenid%2Fid%2F76561198824025938&openid.return_to=http%3A%2F%2F185.246.65.205%2Fauth%2Flogin&openid.response_nonce=2020-12-02T20%3A26%3A36Z2oGQo2EPfnZw2RwCAI5N%2BaC0tTw%3D&openid.assoc_handle=1234567890&openid.signed=signed%2Cop_endpoint%2Cclaimed_id%2Cidentity%2Creturn_to%2Cresponse_nonce%2Cassoc_handle&openid.sig=m4H6XRSusmBwJsktIWxMOU%2FweCA%3D


Хотя сам авторизатор не раз редачил, vendor по фиксам с инета, не помогло.
Вот контроллер авторизации:
<?php

namespace App\Http\Controllers;

use Invisnik\LaravelSteamAuth\SteamAuth;
use App\User;
use Auth;

class AuthController extends Controller
{
    /**
     * @var SteamAuth
     */
    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)) {
                $info->personaname = secureoutput($info->personaname);
                $api_url =  "http://api.steampowered.com/IPlayerService/GetOwnedGames/v0001/?key=8B3C1B487B706DBB8B1042AE490A6C31&steamid=$info->steamID&format=json";
                $json = json_decode(file_get_contents($api_url), true);
                if (!is_null($info)){
					$csgo = 'false';
					$owned = 0;
					$wallet = 100;					
					foreach($json['response'] as $resp => $game_count)
                    {
                        if($game_count == 0){
                            $csgo = 'false';
							$owned = 0;
                        } else {
							$owned = 1;
						}
                    }
					if($owned == 1) { 
                    foreach($json['response']['games'] as $games => $appid)
                    {
                        if($appid['appid'] == 730){
                            $csgo = 'true';
                        }
                    }
					}
                    $user = User::where('steamid', $info->steamID64)->first();
                    if (is_null($user)) {
                        $user = User::create([
                            'username' => $info->personaname,
                            'avatar'   => $info->avatarfull,
                            'steamid'  => $info->steamID64,
                            'wallet'  => $wallet,
                            'csgo' => $csgo
                        ]);
                    } else {
                        $user->update(array('username' => $info->personaname,'avatar' => $info->avatarfull,'wallet' => '100','csgo' => $csgo));
                    }
                    Auth::login($user, true);
                    return redirect('/games'); // redirect to site
                }
            }
        }
        return $this->steam->redirect(); // redirect to Steam login page
    }

    public function logout()
    {
    	Auth::logout();
    	return redirect('/'); // redirect to site
    }
}

function secureoutput($string)
{
    $string=htmlentities(strip_tags($string));
    $string=str_replace('>', '', $string);
    $string=str_replace('<', '', $string);
    $string=htmlspecialchars($string);
    return $string;
}
  • Вопрос задан
  • 150 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы