AoC>TV: Forums
https://static.is-better-than.tv/forums/

Failed authentication
https://static.is-better-than.tv/forums/viewtopic.php?f=4&t=57
Page 1 of 2

Author:  Redfoam [ Sat Jun 22, 2013 6:30 pm ]
Post subject:  Failed authentication

Hi,

I have problems with the module giving me this error:
*Botname* [AAMon] [ERROR] Bot failed authentication, make sure you set the right botkey in settings. If you have lost your botkey, contact Kentarii @ AoC>TV Forums.

To make sure I did ask Kentarii for the correct botkeys, which I got and updates in !settings aamon but still same error after several restarts.

What happend was that the server where I host two Bebots on got PHP updated to 5.4 (from 5.2 I think but really not sure). I haven't updated the Bebot core files since I did set up the bots (a few years ago) and the bots wouldn't start because of "Fatal errors". Found a solution http://bebot.shadow-realm.org/coding-an ... n-php-5-4/ and updated the bot core files and now I got further in starting the bots except that the custom modules started to give me "Fatal errors". I found a solution for this that said that I should change all &$bot to $bot in the modules and it will work with PHP 5.4. I did and everything works except for this error on the AAMon module. Not sure this coding change is connected to the problem though.

I also remember know that I had to replace my bot.conf because the bots complained I did have an old one and refused to start. So just used the template and put in the same information as the old one and renamed.

Anyone got an idea how to fix?

Author:  Kentarii [ Sat Jun 22, 2013 7:23 pm ]
Post subject:  Re: Failed authentication

So in the end.. did you change anything to the the AAMon.php module?

Author:  Redfoam [ Sat Jun 22, 2013 7:29 pm ]
Post subject:  Re: Failed authentication

Yes, I did replace all &$bot to $bot.

Author:  Kentarii [ Sat Jun 22, 2013 7:38 pm ]
Post subject:  Re: Failed authentication

Have you set dimension in your bot.conf? It shows up empty in my logs, so the error is not with botkey, but missing dimension.

You could try setting the dimension directly in AAMon.php (around line 69 in the __construct method)
Code:
        $this -> bot -> core('settings') -> create('AAMon', 'apiurl', 'http://aoc.is-better-than.tv/api.php', "URL to AoC>TV API.");
        $this -> bot -> core('settings') -> create('AAMon', 'botkey', '', "AoC>TV API Key.");
        $this -> bot -> dimension = 'Crom'; // Hardcoded dimension

Author:  Redfoam [ Sat Jun 22, 2013 7:43 pm ]
Post subject:  Re: Failed authentication

Thank you for the answer Kentarii. I tried it but still same error.

Edit:
Saw your new post now. Trying it out!

Author:  Kentarii [ Sat Jun 22, 2013 7:45 pm ]
Post subject:  Re: Failed authentication

Try the dimension fix above.. (I should stop editing my posts..)

Author:  Redfoam [ Sat Jun 22, 2013 7:50 pm ]
Post subject:  Re: Failed authentication

Tried hardcode dimension as well. Still same error.

I do have dimension in my bot.config file as well btw.

Author:  Kentarii [ Sat Jun 22, 2013 7:57 pm ]
Post subject:  Re: Failed authentication

Still not receiving any dimension on my side :(

Try changing this function then and set dimension here.
Code:
    /**
     * Fetch data from the AoC>TV API
     * @param string $op
     * @param array $params
     * @return array
     */
    function fetch_api_data($op, $params = array()) {
        $url = sprintf("%s?op=%s&dimension=%s&botname=%s&botkey=%s&agent=%s&version=%s",
            $this -> bot -> core('settings') -> get('AAMon', 'apiurl'),
            $op,
            urlencode("Crom"), // Hardcoded dimension
            urlencode($this -> bot -> botname),
            urlencode($this -> bot -> core('settings') -> get('AAMon', 'botkey')),
            urlencode($this -> agent),
            urlencode($this -> version)
        );
        if (count($params) > 0) {
            foreach ($params as $k => $v) {
                $url .= '&'. $k .'='. urlencode($v);
            }
        }
        return $this -> bot -> core('tools') -> get_site($url, 1);
    }

Author:  Redfoam [ Sat Jun 22, 2013 8:07 pm ]
Post subject:  Re: Failed authentication

WORKS!!! \o/
Actually the first dimension fix might have fixed it. I'm an idiot and accidently uploaded the modified file to the conf folder since I was looking at the bot.conf file. *facepalm*

Thank you a lot Kentarii! Really really appreciate the help.

Edit:
Yes first dimension fix was enough. Tried it on the other bot. Really sorry for noobing out there.

Author:  Kentarii [ Sat Jun 22, 2013 8:21 pm ]
Post subject:  Re: Failed authentication

Glad we got that sorted out. Might be a bug or change in new version of Bebot.

Page 1 of 2 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/