From 7a22cab34332707ea2fe5d3e690033c424886c9b Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sun, 15 Oct 2017 13:07:39 -0400 Subject: Changed auth password to token --- source/http.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'source/http.c') diff --git a/source/http.c b/source/http.c index be62dce..2ac10fb 100644 --- a/source/http.c +++ b/source/http.c @@ -146,23 +146,13 @@ int submitToApi( WOLFSSL_CTX* sslContext, cJSON* data, const char* username, - const char* password) + const char* token) { // Form request body. cJSON* jRequestBody = cJSON_CreateObject(); cJSON_AddItemToObject(jRequestBody, "game", data); - cJSON_AddItemToObject( - jRequestBody, - "username", - cJSON_CreateString(username)); - - cJSON_AddItemToObject( - jRequestBody, - "password", - cJSON_CreateString(password)); - const char* requestBody = cJSON_PrintUnformatted(jRequestBody); // Gather data from endpoint URL. @@ -304,7 +294,10 @@ int submitToApi( r += sprintf(r, "POST %s HTTP/1.1\r\n", httpPath); r += sprintf(r, "Host: %s\r\n", httpHost); r += sprintf(r, "Content-Type: application/json\r\n"); - r += sprintf(r, "Content-Length: %d\r\n\r\n", strlen(requestBody)); + r += sprintf(r, "Content-Length: %d\r\n", strlen(requestBody)); + r += sprintf(r, "X-User-Login: %s\r\n", username); + r += sprintf(r, "X-User-Token: %s\r\n", token); + r += sprintf(r, "\r\n"); int result = tcpWrite( secure, -- cgit 1.4.1