From cee6ffbf459e2183869becfb9ac9922c2fa5391d Mon Sep 17 00:00:00 2001 From: Reckless_Satoshi Date: Sat, 4 Mar 2023 02:14:45 -0800 Subject: [PATCH] Fix authenticated requests on Native --- .../src/services/api/ApiNativeClient/index.ts | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/frontend/src/services/api/ApiNativeClient/index.ts b/frontend/src/services/api/ApiNativeClient/index.ts index dd677bc1..f091ef23 100644 --- a/frontend/src/services/api/ApiNativeClient/index.ts +++ b/frontend/src/services/api/ApiNativeClient/index.ts @@ -10,20 +10,16 @@ class ApiNativeClient implements ApiClient { 'Content-Type': 'application/json', }; - const robotToken = systemClient.getItem('robot_token'); - if (robotToken) { - const sessionid = systemClient.getCookie('sessionid'); - const csrftoken = systemClient.getCookie('csrftoken'); - const pubKey = systemClient.getItem('pub_key'); + const sessionid = systemClient.getCookie('sessionid'); + const csrftoken = systemClient.getCookie('csrftoken'); - headers = { - ...headers, - ...{ - 'X-CSRFToken': csrftoken, - Cookie: `sessionid=${sessionid};robot_token=${robotToken};csrftoken=${csrftoken};pub_key=${pubKey}`, - }, - }; - } + headers = { + ...headers, + ...{ + 'X-CSRFToken': csrftoken, + Cookie: `sessionid=${sessionid};token=${csrftoken}`, + }, + }; return headers; };