Patrity
Extreme Donator
- Jul 31, 2008
- 965
- 102
- 0
PLEASE FOR THE LOVE OF ALL THAT IS HOLY.. CHANGE THE API KEYS.
This guide is only for my Kronos release located here: https://www.rune-server.ee/runescap...er-deob-client-multi-world-support-184-a.html
This will not work on your ruse server, however.. feel free to take a look at how we handled the server side. XenForo's API is super easy to integrate with and synced forum accounts are a good thing in 2020
Authentication
For this to function correctly, you will need to have purchased a XenForo license.
If you prefer IPB, "Brandito" has provided a script to do so here:
I have not personally tested this and much prefer XenForo's API so YMMV!
IPB Docs: https://invisioncommunity.com/devel...ods/creating-a-usernamepassword-handler-r174/
Setup a new page and pageblock via the ACP and use the following script:
Log in to your ACP on your xenforo install and head to the API Keys Section, create a new API Key
Set the title to whatever you'd like but be descriptive, just as best practices.
You also need to select the Super User perm in order to use the auth scope.
Now - in general, never give more permission than what is needed for API keys.
For this, all you need is auth. If you select other things and your key is leaked, people could delete your forum or other malicious things. Use common sense.
Copy this key, using the button, so that you're sure it's exact.
Now - Let's head into your IDE and open up `XenforoUtils` class located within the Central Server module.
You'll want to adjust the forums URL and the Auth key variables. Do not adjust anything else unless you know what you're doing.
That's it. Auth done.
World List
Now in order to setup the world list, you will need to download a small php script --> HERE <--
Simply place this on your web service somewhere.
Open `world_updater.php`and modify this API key.
I recomend using something like LastPass in order to generate a secure 32 character api key.
Now go back to your IDE and open `WorldList` within the Central Server module.
First, place the same auth key you just generated, on line 16.
Second, go to line 59 and modify your url to where your newly uploaded php script is.
Example: https://example.com/someFolder/world_updater.php?k=
LEAVE THE "?k=" This is where the auth token will be placed in the request.
And done. Now, the central server will automatically update the "worlds.ws" file whenever a new world is registered so that you can load more than one world.
A note about security best practices.
I'll be the first to admit, we did not do everything properly at Kronos. You should never hard code API keys, so please, load these keys elsewhere like from a json or properties file. Also, API security is extremely important. You are potentially opening up your entire service to outside influence if you do not have secure API keys. PLEASE DO NOT SHORTCUT THIS!
This guide is only for my Kronos release located here: https://www.rune-server.ee/runescap...er-deob-client-multi-world-support-184-a.html
This will not work on your ruse server, however.. feel free to take a look at how we handled the server side. XenForo's API is super easy to integrate with and synced forum accounts are a good thing in 2020
Authentication
For this to function correctly, you will need to have purchased a XenForo license.
If you prefer IPB, "Brandito" has provided a script to do so here:
Spoiler for IPB Integration:
I have not personally tested this and much prefer XenForo's API so YMMV!
IPB Docs: https://invisioncommunity.com/devel...ods/creating-a-usernamepassword-handler-r174/
Setup a new page and pageblock via the ACP and use the following script:
Code:
if (isset(\IPS\Request::i()->token)) {
$FIND_TOKEN = 'WRITE A CUSTOM TOKEN HERE FOR ADDED SECURITY! e.g ab442ae66ff03eea56f9a994bb9f22fa346f';
$providedToken = \IPS\Request::i()->token;
if ($FIND_TOKEN === $providedToken) {
if (isset(\IPS\Request::i()->login) and isset(\IPS\Request::i()->password)) {
$login = new \IPS\Login();
$loginHandler = \IPS\Login\Handler::findMethod('IPS\Login\Handler\Standard');
$loginname = \IPS\Request::i()->login;
if (!ctype_alnum($loginname))
die(json_encode(array("errorMessage" => "Username contained disallowed words.")));
try {
$member = $loginHandler->authenticateUsernamePassword($login, $loginname, \IPS\Request::i()->protect('password'));
echo json_encode(
array(
"user_id" => $member->member_id,
"username" => $member->name,
"user_group_id" => $member->member_group_id,
"secondary_group_ids" => array(2) //REGISTERED GROUP
)
);
} catch (\IPS\Login\Exception $ex) {
if ($ex->getMessage() == 'login_err_bad_password') {
echo json_encode(array("errorMessage" => "Incorrect password. Please try again."));
} else {
echo json_encode(array("errorMessage" => "Unregistered account."));
}
}
} else {
echo json_encode(array("errorMessage" => "Something went wrong. An account could not be found."));
}
} else {
echo json_encode(array("errorMessage" => "Invalid token."));
}
} else {
echo json_encode(array("errorMessage" => "A query parameter was missing."));
}
Log in to your ACP on your xenforo install and head to the API Keys Section, create a new API Key

Set the title to whatever you'd like but be descriptive, just as best practices.
You also need to select the Super User perm in order to use the auth scope.
Now - in general, never give more permission than what is needed for API keys.
For this, all you need is auth. If you select other things and your key is leaked, people could delete your forum or other malicious things. Use common sense.

Copy this key, using the button, so that you're sure it's exact.

Now - Let's head into your IDE and open up `XenforoUtils` class located within the Central Server module.
You'll want to adjust the forums URL and the Auth key variables. Do not adjust anything else unless you know what you're doing.

That's it. Auth done.
World List
Now in order to setup the world list, you will need to download a small php script --> HERE <--
Simply place this on your web service somewhere.
Open `world_updater.php`and modify this API key.
I recomend using something like LastPass in order to generate a secure 32 character api key.

Now go back to your IDE and open `WorldList` within the Central Server module.
First, place the same auth key you just generated, on line 16.

Second, go to line 59 and modify your url to where your newly uploaded php script is.
Example: https://example.com/someFolder/world_updater.php?k=
LEAVE THE "?k=" This is where the auth token will be placed in the request.

And done. Now, the central server will automatically update the "worlds.ws" file whenever a new world is registered so that you can load more than one world.
A note about security best practices.
I'll be the first to admit, we did not do everything properly at Kronos. You should never hard code API keys, so please, load these keys elsewhere like from a json or properties file. Also, API security is extremely important. You are potentially opening up your entire service to outside influence if you do not have secure API keys. PLEASE DO NOT SHORTCUT THIS!
Last edited: