还附上了我得到200ok响应的图像。
现在我从应用程序方面做了什么?我认为它的许可问题但无法解决请建议。
还附上如下代码: -
Interceptor interceptor = new Interceptor() {
@Override
public okhttp3.Response intercept(Interceptor.Chain chain) throws IOException {
Request newRequest = chain.request()
.newBuilder()
.addHeader("content-type", "application/x-www-form-urlencoded")
.addHeader("host", "ag7fce49bf5ti.iot.us-east-1.amazonaws.com")
.addHeader("x-amz-date", "20160919T054450Z")
.addHeader("authorization", "AWS4-HMAC-SHA256 Credential=AKIAJ6XB3CLURFLV6ISQ/20160919/us-east-1/iotdata/aws4_request, SignedHeaders=content-type;host;x-amz-date, Signature=af7cd8cee7dd4763cff3a1c8f91cdde1fa22cc68012248a694cee098981bc623")
.build();
return chain.proceed(newRequest);
}
};
OkHttpClient.Builder builder = new OkHttpClient.Builder();
builder.interceptors().add(interceptor);
client = builder.build();
Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://ag7fce49bf5ti.iot.us-east-1.amazonaws.com/things/dm_project/shadow/")
//.addConverterFactory(client)
.client(client)
.build();