Android POST Request Returning 403 From AWS API Gateway
I'm using AWS Lambda w/ API gateway triggers and I am running into an issue. I'm using RetroFit to make a POST request and I'm getting a 403 for my response back. I am passing a JS
Solution 1:
I think you are using Retrofit 2, and Retrofit 2 uses the same rules as .
If you have a leading '/' on your path, it will consider as absolute path.
public interface AmazonService {
@Headers("Content-Type: application/json; charset=utf8")
@POST("/lio")
Observable<ResponseBody> getAmazonResponse();
}
amazonRetrofit = new Retrofit.Builder()
.client(okHttpClient)
.baseUrl("https://eun533ayha.execute-api.us-west-1.amazonaws.com/Prod/")
.build();
Result: https://eun533ayha.execute-api.us-west-1.amazonaws.com/lio
If you remove the leading '/' on your path, it will consider as related path.
public interface AmazonService {
@Headers("Content-Type: application/json; charset=utf8")
@POST("lio")
Observable<ResponseBody> getAmazonResponse();
}
amazonRetrofit = new Retrofit.Builder()
.client(okHttpClient)
.baseUrl("https://eun533ayha.execute-api.us-west-1.amazonaws.com/Prod/")
.build();
Result: https://eun533ayha.execute-api.us-west-1.amazonaws.com/Prod/lio
In your case, it looks like that you have a stage 'Prod' and your integration is on the resource '/lio'. I think it will work if you remove the leading '/'.
Post a Comment for "Android POST Request Returning 403 From AWS API Gateway"