i'm having small problems with my maniaconnect authentication

the basic code:
Code: Select all
try {
$maniaconnect = new \Maniaplanet\WebServices\ManiaConnect\Player(API_USER, API_PASS);
$player = $maniaconnect->getPlayer();
if ($player) {
$buddies = $maniaconnect->getBuddies();
// Do stuff with buddies
} else {
$loginURL = $maniaconnect->getLoginURL("basic buddies");
// Display link for granting access
}
} catch (\Maniaplanet\WebServices\Exception $e) {
// Display error
}
after loading the page again it works fine
i tried retrying directly (without the need of reloading the page manually) with an extra try-catch but it doesn't help
Code: Select all
try {
$buddies = $maniaconnect->getBuddies();
}
catch (\Maniaplanet\WebServices\Exception $e) {
switch ($e->getHTTPStatusCode()) {
case 401: {
$buddies = $maniaconnect->getBuddies();
break;
}
default: {
throw $e;
break;
}
}
}
maybe it has something to do with the redirection uri as it only appears right after clicking on the login button.. but the stuff of the basic scope is retrieved properly without problems..
any ideas why it's behaving like that?
thanks in advance
steff
p.s. you can see the issue in action on my manialink RockPaperScissors (Vs. Buddy) // manialink is down by now
// Edit: fixed typo