mirror of
https://github.com/pierre42100/ComunicAndroid
synced 2024-11-23 22:09:30 +00:00
Integrated API tokens
This commit is contained in:
parent
9c06507d0c
commit
ee945f58e0
@ -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 {
|
||||||
|
@ -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
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user