F
F
foggus2020-12-02 23:30:11
API
foggus, 2020-12-02 23:30:11

Steam authorization issue on laravel site?

Hello, I have been suffering for a long time with an incomprehensible authorization problem on the site.
The site on laravel, php, js, I don’t know what the problem is during authorization, it gives out:

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


Although the authorizer himself redacted more than once, vendor fixes from the Internet did not help.
Here is the authorization controller:
<?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;
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question