aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDedicatedTest/masterserver.cpp
diff options
context:
space:
mode:
authorBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-11-13 18:37:46 +0000
committerBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-11-13 18:37:46 +0000
commit3d3d2c2a13a292a9093ad3029563a1c543a07ab7 (patch)
tree60812cb186f9429d7002879167e4102e353ee2d1 /NorthstarDedicatedTest/masterserver.cpp
parentae09e612ea33cb105a47996c4ae3bf8651119042 (diff)
downloadNorthstarLauncher-3d3d2c2a13a292a9093ad3029563a1c543a07ab7.tar.gz
NorthstarLauncher-3d3d2c2a13a292a9093ad3029563a1c543a07ab7.zip
client auth token support
Diffstat (limited to 'NorthstarDedicatedTest/masterserver.cpp')
-rw-r--r--NorthstarDedicatedTest/masterserver.cpp10
1 files changed, 7 insertions, 3 deletions
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<std::mutex> guard(g_ServerAuthenticationManager->m_authDataMutex);