Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server returns 403 Forbidden error on auth step #8

Open
shafeey opened this issue Jan 15, 2020 · 3 comments
Open

Server returns 403 Forbidden error on auth step #8

shafeey opened this issue Jan 15, 2020 · 3 comments

Comments

@shafeey
Copy link

shafeey commented Jan 15, 2020

I was receiving this error during login:

PHP Fatal error:  Uncaught JsonException: Syntax error in /home/shafeey/fut-api/src/Api/AbstractCore.php:339
Stack trace:
#0 /home/shafeey/fut-api/src/Api/AbstractCore.php(339): json_decode('', true, 512, 4194304)
#1 /home/shafeey/fut-api/test.php(37): Shapecode\FUT\Client\Api\AbstractCore->login('881689')

As I looked deeper, I found that the POST request to "https://utas.external.s2.fut.ea.com:443/ut/auth?client=webcomp" is returning 403 FORBIDDEN with an empty body, which in turn results in the json_decode() exception.

$call = $this->simpleRequest('POST', $this->getFutAuthUrl(), [

I'm using the following script for login and putting the code from verification email. Any idea what I am doing wrong? Thank you.

<?php

// Autoload files using the Composer autoloader.
require_once __DIR__ . '/vendor/autoload.php'; 

use Shapecode\FUT\Client\Api\Core;
use Shapecode\FUT\Client\Exception\FutError;
use Shapecode\FUT\Client\Authentication\Account;
use Shapecode\FUT\Client\Authentication\Credentials;
use Shapecode\FUT\Client\Authentication\Session;


$email = "email@email.com";
$password = "PASSWD";
$platform = "ps4";
$code = "999999";

$credentials = new Credentials($email, $password, $platform);

$session = null;

$account = new Account($credentials, $session);
$fut = new Core($account);

try {
    $login = $fut->login($code);
    $session = $account->getSession();
} catch(FutError $e) {
    $reason = $e->getReason();
    die("We have an error logging in: ".$reason);
}
echo "Login complete...\n";
@adamgiesinger
Copy link

I can't really help you as I'm unable to replicate the issue. What version of fut-api are you on?

@serggi
Copy link

serggi commented Apr 6, 2020

Hi, @shafeey
I had the same error and I understand how to fix it in my situation.
Quick fix is to check and modify the line.

$persona = array_pop($personasValues);

In case you have more than one account used on different platforms here you just get the first array element. You can use Curtis old logic or implement your own.

At that moment my quick fix is
$persona_id = null; foreach ($personasValues as $personasValue) { if ($personasValue['onlineAccess']) { $persona_id = $personasValue['personaId']; } }

@nicklog
Can you check Telegram. I sent you a message.

@nicklog
Copy link
Contributor

nicklog commented Apr 7, 2020

@serggi Would you make a PR so we can add a fix for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants