I'm pretty new to AWS and I'd like to use a service in my Android app. Unfortunately, this service, AWS AppConfig, doesn't have a mobile SDK yet, so I've been trying to send a GET request to the GetConfiguration API with okhttp.
To sign the request, I'm using AWS4Signer from the AWS Android SDK. I'm providing credentials with an implementation of AWSCredentials.
com.amazonaws.Request requestAws = new DefaultRequest(amazonWebServiceRequest, serviceName);
URI uri = URI.create("https://appconfig.us-west-2.amazonaws.com/applications/[applicationID]/environments/[environmentID]/configurations/[configurationID]?client_id=ClientId");
requestAws.setEndpoint(uri);
requestAws.setHttpMethod(HttpMethodName.GET);
AWS4Signer signer = new AWS4Signer();
signer.setServiceName(serviceName);
signer.setRegionName(Regions.US_WEST_2.getName());
signer.sign(requestAws, credentials);
// get relevant authorization headers from requestAws and insert them in the okhttp request as headers
When I send a request to GetConfiguration, it fails with
The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.
I tried sending a request to GetDeploymentStrategy, and that was successful, so I don't think it's my credentials or how I'm attaching them to the request.
I think the problem is with how I'm attaching the request parameters, since the APIs that don't require additional request params succeed (GetDeploymentStrategy and GetApplication), while GetConfiguration, which requires client_id
, fails.
My question is: are there any examples of how to handle request parameters with the signer and request?
Thanks very much.