I am working with remote.it api Here is documentation https://link.remote.it/docs/graphql I have created a test account which acess is
R3_ACCESS_KEY_ID=########
R3_SECRET_ACCESS_KEY=################
Remote it have insomnia plugins, Using those plugins I can send a request to the site which is working fine
Now I convert it to okhttp request but it always show unauthorized. I have tried with lots of options but it's not work for me.
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/graphql");
RequestBody body = RequestBody.create(mediaType, "{\"query\":\"#Query\\n\\nquery getDevices($size: Int, $from: Int, $sort: String) {\\n login {\\n devices(size: $size, from: $from, sort: $sort) {\\n total\\n hasMore\\n items {\\n id\\n name\\n hardwareId\\n created\\n services {\\n id\\n name\\n port\\n type\\n state\\n host\\n enabled\\n }\\n }\\n }\\n }\\n}\\n\\n\",\"variables\":{\"size\":1000,\"from\":0}}");
Request request = new Request.Builder()
.url("https://api.remote.it/graphql/v1")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("Date", "Mon, 09 Aug 2021 07:44:57 GMT")
.addHeader("Authorization", "Signature keyId="KHHUWNUWBY6NFXLOWSSA",algorithm="hmac-sha256",headers="(request-target) host date content-type content-length",signature="zQO/9ehBLSt80jXk26Rxvgi/wJixEDJiXG9X5sXeloo="")
.build();
Response response = client.newCall(request).execute();
I am not getting any way to solve this issue..Can anyone help me to solve this unauthorized issue?