[Bug]: Failed to Create Session
By submitting this bug issue, you agree to the following.
- [X] This is a bug in the software that resides in this repository, and not a support matter (use https://otland.net/forums/support.16/ for support)
- [X] This issue is reproducible without changes to the C++ code in this repository
- [X] This bug has not been resolved in master branch
- [x] There is no existing issue for this bug already
Does this bug crash tfs?
no
Server Version
1.6 (Release)
Operation System
Windows
OS Description
Window 11
Bug description
Upon attempting login, get error "failed to create session"
Possible Pull Requests which are to blame
- [ ] #
- [ ] #
Steps to reproduce
Open server -> Login = Error
Using MyAAC latest version also.
Actual Behavior
Expected Behavior
.
Backtrace
No response
Can you check with types are used in Session table + default values? You can try test using this fix: https://github.com/otland/forgottenserver/pull/4745
Problem still persists after this change unfortunately.
Please try to turn off apache and only run mysql server, then change in config.lua httpPort = 80 and try to login.
If that works then your aac needs to be patched in order to successfully login
Please try to turn off apache and only run mysql server, then change in config.lua
httpPort = 80and try to login. If that works then your aac needs to be patched in order to successfully login
I encountered the same error while attempting to connect. I'm using only MySQL server with the OTClient by Mehah. Additionally, I'm running the MySQL server on Docker, and the environment is Windows. The issue appears to persist.
Same problem for me.
Please try to turn off apache and only run mysql server, then change in config.lua
httpPort = 80and try to login. If that works then your aac needs to be patched in order to successfully loginI encountered the same error while attempting to connect. I'm using only MySQL server with the OTClient by Mehah. Additionally, I'm running the MySQL server on Docker, and the environment is Windows. The issue appears to persist.
As far as I know Mehah's Client never worked with the current protocol (taken from his github)
function g_game.getSupportedClients()
return { 740, 741, 750, 755, 760, 770, 772, 780, 781, 782, 790, 792, 800, 810, 811, 820, 821, 822, 830, 831, 840,
842, 850, 853, 854, 855, 857, 860, 861, 862, 870, 871, 900, 910, 920, 931, 940, 943, 944, 951, 952, 953,
954, 960, 961, 963, 970, 971, 972, 973, 980, 981, 982, 983, 984, 985, 986, 1000, 1001, 1002, 1010, 1011,
1012, 1013, 1020, 1021, 1022, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1050,
1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1070, 1071, 1072, 1073,
1074, 1075, 1076, 1080, 1081, 1082, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1281, 1285,
1286, 1287, 1291, 1300, 1314, 1316, 1320, 1321, 1332 }
end
Unless Mehah changes that there is currently no way to connect with it
I suggest for now getting the 13.10.12892 client, this one is confirmed to be working
I really had to add to this list to try to log in with client 13.10. Considering this, should we update the project's README? We should also consider adding a tutorial on how to find these supported clients in TFS.
The Forgotten Server is a free and open-source MMORPG server emulator written in C++. It is a fork of the [OpenTibia Server](https://github.com/opentibia/server) project. To connect to the server, you can use [OTClient](https://github.com/mehah/otclient).
We already got the login for Mehah's otc working, we just need to polish the details and propose a PR. For anyone interested to try the workaround and report back if it worked for him, I'll leave a step by step guide in this post.
TFS side:
- config.lua
httpPort = 80
Client side:
- entergame.lua
ip = world.externaladdress,->ip = world.externaladdressunprotected,port = world.externalport,->port = world.externalportunprotected, - features.lua
g_game.enableFeature(GameSequencedPackets)->--g_game.enableFeature(GameSequencedPackets) - game.lua from:
function g_game.getSupportedClients()
return { 740, 741, 750, 755, 760, 770, 772, 780, 781, 782, 790, 792, 800, 810, 811, 820, 821, 822, 830, 831, 840,
842, 850, 853, 854, 855, 857, 860, 861, 862, 870, 871, 900, 910, 920, 931, 940, 943, 944, 951, 952, 953,
954, 960, 961, 963, 970, 971, 972, 973, 980, 981, 982, 983, 984, 985, 986, 1000, 1001, 1002, 1010, 1011,
1012, 1013, 1020, 1021, 1022, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1050,
1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1070, 1071, 1072, 1073,
1074, 1075, 1076, 1080, 1081, 1082, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1281, 1285,
1286, 1287, 1291, 1300, 1314, 1316, 1320, 1321, 1332 }
end
to:
function g_game.getSupportedClients()
return { 740, 741, 750, 755, 760, 770, 772, 780, 781, 782, 790, 792, 800, 810, 811, 820, 821, 822, 830, 831, 840,
842, 850, 853, 854, 855, 857, 860, 861, 862, 870, 871, 900, 910, 920, 931, 940, 943, 944, 951, 952, 953,
954, 960, 961, 963, 970, 971, 972, 973, 980, 981, 982, 983, 984, 985, 986, 1000, 1001, 1002, 1010, 1011,
1012, 1013, 1020, 1021, 1022, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1050,
1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1070, 1071, 1072, 1073,
1074, 1075, 1076, 1080, 1081, 1082, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1281, 1285,
1286, 1287, 1291, 1300, 1310, 1314, 1316, 1320, 1321, 1332 }
end
This should let you correctly login
2. features.lua
g_game.enableFeature(GameSequencedPackets)->--g_game.enableFeature(GameSequencedPackets)
left side is the same as right side
- features.lua
g_game.enableFeature(GameSequencedPackets)->--g_game.enableFeature(GameSequencedPackets)left side is the same as right side
Read again, it's not..
Different Error this time, this is with all of above changes. Thank you all for effort trying to resolve this =) Fingers crossed we get there.
Different Error this time, this is with all of above changes. Thank you all for effort trying to resolve this =) Fingers crossed we get there.
Do you have Apache turned on, If yes then try to change the httpPort in tfs to anything else and have it matching in the client, kinda curious If that works
[  ](https://private-user-images.githubusercontent.com/97258974/339247287-9213a538-0290-4094-8154-94a3c96bfe27.gif?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTgyNjM0MzIsIm5iZiI6MTcxODI2MzEzMiwicGF0aCI6Ii85NzI1ODk3NC8zMzkyNDcyODct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4MzcwN2Q0YWFiMDcwZmY2ZDQ1Zjg1ZTExYzI1ZmRlYmY3MGQ5NmZhYjQ0NzhkNTE2ZmM1Yjg4ZWRhMzFmYmMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.zxuls_bMzsReHAh0ErQY_a9S-hMFUvQwt8Tqw3OWolA) [  ](https://private-user-images.githubusercontent.com/97258974/339247287-9213a538-0290-4094-8154-94a3c96bfe27.gif?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTgyNjM0MzIsIm5iZiI6MTcxODI2MzEzMiwicGF0aCI6Ii85NzI1ODk3NC8zMzkyNDcyODctOTIxM2E1MzgtMDI5MC00MDk0LTgxNTQtOTRhM2M5NmJmZTI3LmdpZj9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjEzVDA3MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTg4MzcwN2Q0YWFiMDcwZmY2ZDQ1Zjg1ZTExYzI1ZmRlYmY3MGQ5NmZhYjQ0NzhkNTE2ZmM1Yjg4ZWRhMzFmYmMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.zxuls_bMzsReHAh0ErQY_a9S-hMFUvQwt8Tqw3OWolA) [  ](https://private-user-images.githubusercontent.com/97258974/339247287-9213a538-0290-4094-8154-94a3c96bfe27.gif?jwt=eyJhbGciOiJI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C1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.zxuls_bMzsReHAh0ErQY_a9S-hMFUvQwt8Tqw3OWolA)Different Error this time, this is with all of above changes. Thank you all for effort trying to resolve this =) Fingers crossed we get there.
Do you have Apache turned on, If yes then try to change the httpPort in tfs to anything else and have it matching in the client, kinda curious If that works
Same error no matter the httpPort, Apache is indeed turned on.
- features.lua
g_game.enableFeature(GameSequencedPackets)->--g_game.enableFeature(GameSequencedPackets)left side is the same as right side
Read again, it's not..
ok.. i missed "--" there :D
I am having the same issue, I followed the steps on the work around and go to the same spot as @RickParky . I also tried the port change as suggested with the same error: please see the attached GIF.
I am currently running the Mysql DB on a ubuntu 22 lts server and the server was compiled today and is running on windows 11.
remove .php from 127.0.0.1/login.php
I am having the same issue, I followed the steps on the work around and go to the same spot as @RickParky . I also tried the port change as suggested with the same error: please see the attached GIF.
I am currently running the Mysql DB on a ubuntu 22 lts server and the server was compiled today and is running on windows 11.
remove .php from
127.0.0.1/login.phpI am having the same issue, I followed the steps on the work around and go to the same spot as @RickParky . I also tried the port change as suggested with the same error: please see the attached GIF. I am currently running the Mysql DB on a ubuntu 22 lts server and the server was compiled today and is running on windows 11.
Same error
I fixed this issue on protocollogin.cpp
here's the new code:
// Generate and add session key static std::independent_bits_engine<std::default_random_engine, CHAR_BIT, unsigned short> rbe; std::string sessionKey(16, '\x00'); std::generate(sessionKey.begin(), sessionKey.end(), std::ref(rbe));
output->addByte(0x28);
output->addString(tfs::base64::encode({sessionKey.data(), sessionKey.size()}));
// Convert sessionKey to hexadecimal
std::string sessionKeyHex;
for (unsigned char c : sessionKey) {
sessionKeyHex += fmt::format("{:02x}", c);
}
// Insert the session into the database
if (!db.executeQuery(fmt::format(
"INSERT INTO `sessions` (`token`, `account_id`, `ip`) VALUES (UNHEX('{}'), {}, INET6_ATON('{}'))",
sessionKeyHex, account.id, getConnection()->getIP().to_string()))) {
disconnectClient("Failed to create session.\nPlease try again later.", version);
return;
}
@froomzim what version of MySQL/MariaDB are you running?
@froomzim what version of MySQL/MariaDB are you running?
mysql Ver 15.1 Distrib 10.4.32-MariaDB, for Win64 (AMD64), source revision c4143f909528e3fab0677a28631d10389354c491
I fixed this issue on protocollogin.cpp
here's the new code:
// Generate and add session key static std::independent_bits_engine<std::default_random_engine, CHAR_BIT, unsigned short> rbe; std::string sessionKey(16, '\x00'); std::generate(sessionKey.begin(), sessionKey.end(), std::ref(rbe));
output->addByte(0x28); output->addString(tfs::base64::encode({sessionKey.data(), sessionKey.size()})); // Convert sessionKey to hexadecimal std::string sessionKeyHex; for (unsigned char c : sessionKey) { sessionKeyHex += fmt::format("{:02x}", c); } // Insert the session into the database if (!db.executeQuery(fmt::format( "INSERT INTO `sessions` (`token`, `account_id`, `ip`) VALUES (UNHEX('{}'), {}, INET6_ATON('{}'))", sessionKeyHex, account.id, getConnection()->getIP().to_string()))) { disconnectClient("Failed to create session.\nPlease try again later.", version); return; }
I've managed to login using this method on locahost, using xampp no problems. Thank you!
I've managed to login using this method on locahost, using xampp no problems. Thank you!
Glad to know, gl bro
TFS
Last commits tfs 98ff8a81: fix NPC baseSpeed & build issue (AccountType_t)
+
OTC Redemption
Last Commits OTC 937573e : feat: add scheduleEvent. cycleEvent and removeEvent in controller
+
g_game.disableFeature(GameSequencedPackets)
https://github.com/otland/forgottenserver/assets/114332266/2065b69f-ce47-4627-b353-aff725c30c0f
port 80 or 8080 work
can login with OTC Redemption and CipSoft
test in 10.6.12-MariaDB and login.php of myacc
Tibia13.10.12892.zip
https://downloads.ots.me/?dir=data/tibia-clients/windows/zip
change ip :
https://ots.me/ots-ip-changer-12/
login.php
https://github.com/slawkens/myaac