From 3d3d2c2a13a292a9093ad3029563a1c543a07ab7 Mon Sep 17 00:00:00 2001 From: BobTheBob <32057864+BobTheBob9@users.noreply.github.com> Date: Sat, 13 Nov 2021 18:37:46 +0000 Subject: client auth token support --- NorthstarDedicatedTest/masterserver.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'NorthstarDedicatedTest/masterserver.cpp') diff --git a/NorthstarDedicatedTest/masterserver.cpp b/NorthstarDedicatedTest/masterserver.cpp index 9ac88667..1d639f28 100644 --- a/NorthstarDedicatedTest/masterserver.cpp +++ b/NorthstarDedicatedTest/masterserver.cpp @@ -84,7 +84,7 @@ void MasterServerManager::AuthenticateOriginWithMasterServer(char* uid, char* or spdlog::info("Trying to authenticate with northstar masterserver for user {} {}", uidStr, tokenStr); - if (auto result = http.Get(fmt::format("/client/origin_auth?uid={}&token={}", uidStr, tokenStr).c_str())) + if (auto result = http.Get(fmt::format("/client/origin_auth?id={}&token={}", uidStr, tokenStr).c_str())) { m_successfullyConnected = true; @@ -103,8 +103,12 @@ void MasterServerManager::AuthenticateOriginWithMasterServer(char* uid, char* or goto REQUEST_END_CLEANUP; } - if (originAuthInfo["success"].IsTrue()) + if (originAuthInfo["success"].IsTrue() && originAuthInfo.HasMember("token") && originAuthInfo["token"].IsString()) + { + strncpy(m_ownClientAuthToken, originAuthInfo["token"].GetString(), sizeof(m_ownClientAuthToken)); + m_ownClientAuthToken[sizeof(m_ownClientAuthToken) - 1] = 0; spdlog::info("Northstar origin authentication completed successfully!"); + } else spdlog::error("Northstar origin authentication failed"); } @@ -324,7 +328,7 @@ void MasterServerManager::AuthenticateWithOwnServer(char* uid, char* playerToken goto REQUEST_END_CLEANUP; } - newAuthData.pdata[i++] = byte.GetUint(); + newAuthData.pdata[i++] = (char)byte.GetUint(); } std::lock_guard guard(g_ServerAuthenticationManager->m_authDataMutex); -- cgit v1.2.3