From ee945f58e009f8f1954c48a5f507596b3050d431 Mon Sep 17 00:00:00 2001 From: Pierre Date: Tue, 2 Jan 2018 17:54:51 +0100 Subject: [PATCH] Integrated API tokens --- app/build.gradle | 4 ++-- .../android/comunic/client/api/APIRequest.java | 13 ++++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 6d722dc..483c0d1 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -16,8 +16,8 @@ android { debug { //Connexion to the internal API of Comunic buildConfigField "String", "api_url", "\"http://devweb.local/comunic/api/\"" - buildConfigField "String", "api_service_name", "\"testService\"" - buildConfigField "String", "api_service_token", "\"testPasswd\"" + buildConfigField "String", "api_service_name", "\"ComunicAndroid\"" + buildConfigField "String", "api_service_token", "\"5eQ8WGAeDTTyY\"" } release { diff --git a/app/src/main/java/org/communiquons/android/comunic/client/api/APIRequest.java b/app/src/main/java/org/communiquons/android/comunic/client/api/APIRequest.java index ffbd98e..fd1b4df 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/api/APIRequest.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/api/APIRequest.java @@ -45,7 +45,8 @@ public class APIRequest { */ public APIResponse exec(APIRequestParameters parameters) throws Exception{ - //Add login tokens + //Add API and login tokens + addAPItokens(parameters); addLoginTokens(parameters); APIResponse result = new APIResponse(); @@ -113,6 +114,16 @@ public class APIRequest { } + /** + * Add the API client tokens to API request object + * + * @param params The request parametres to update + */ + private void addAPItokens(APIRequestParameters params){ + params.addParameter("serviceName", BuildConfig.api_service_name); + params.addParameter("serviceToken", BuildConfig.api_service_token); + } + /** * Add the login tokens to an API request object *