Integrated API tokens

This commit is contained in:
Pierre 2018-01-02 17:54:51 +01:00
parent 9c06507d0c
commit ee945f58e0
2 changed files with 14 additions and 3 deletions

View File

@ -16,8 +16,8 @@ android {
debug { debug {
//Connexion to the internal API of Comunic //Connexion to the internal API of Comunic
buildConfigField "String", "api_url", "\"http://devweb.local/comunic/api/\"" buildConfigField "String", "api_url", "\"http://devweb.local/comunic/api/\""
buildConfigField "String", "api_service_name", "\"testService\"" buildConfigField "String", "api_service_name", "\"ComunicAndroid\""
buildConfigField "String", "api_service_token", "\"testPasswd\"" buildConfigField "String", "api_service_token", "\"5eQ8WGAeDTTyY\""
} }
release { release {

View File

@ -45,7 +45,8 @@ public class APIRequest {
*/ */
public APIResponse exec(APIRequestParameters parameters) throws Exception{ public APIResponse exec(APIRequestParameters parameters) throws Exception{
//Add login tokens //Add API and login tokens
addAPItokens(parameters);
addLoginTokens(parameters); addLoginTokens(parameters);
APIResponse result = new APIResponse(); 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 * Add the login tokens to an API request object
* *