Playframework 2.0 Shopify无法授权使用WS

Playframework 2.0 Shopify无法授权使用WS,playframework-2.0,shopify,Playframework 2.0,Shopify,我已经为Shopify站点设置了一个API密钥,并且能够使用以下代码执行GET请求 DefaultHttpClient httpClient = new DefaultHttpClient(); HttpGet get = new HttpGet("https://75da...:2a1dd3...@mytest.myshopify.com/admin/products.json"); response = httpClient.execute(get); 上面是一个junit测试,使用A

我已经为Shopify站点设置了一个API密钥,并且能够使用以下代码执行GET请求

DefaultHttpClient httpClient = new DefaultHttpClient();

HttpGet get = new HttpGet("https://75da...:2a1dd3...@mytest.myshopify.com/admin/products.json");

response = httpClient.execute(get);
上面是一个junit测试,使用ApacheHttpComponents客户端4.2.3和httpcomponents核心4.2.4

使用相同的参数,我尝试使用WS.url(),但得到的响应是401-Unauthorized With message in body

[API]无效的API密钥或访问令牌(无法识别的登录名或错误的密码)

我在junit测试中使用的代码:

WSRequestHolder requestHolder = WS.url("https://75da...:2a1dd3...@mytest.myshopify.com/admin/products.json");

Promise<Response> promise = requestHolder.get();
Response response = promise.get();
WSRequestHolder-requestHolder=WS.url(“https://75da...:2a1dd3...@mytest.myshopify.com/admin/products.json);
Promise Promise=requestHolder.get();
Response=promise.get();
我正在使用play 2.1.3

所以区别在于使用apache和WS,我认为WS需要一些配置。有人能提供一些见解吗


谢谢,我发现了这个问题。例如,在使用WS时,我必须设置身份验证

WSRequestHolder requestHolder = WS.url("https://mytest.myshopify.com/admin/products.json");     

requestHolder.setAuth("75da...", "2a1dd3...");
Promise<Response> promise = requestHolder.get();
WSRequestHolder-requestHolder=WS.url(“https://mytest.myshopify.com/admin/products.json");     
setAuth(“75da…”,“2a1dd3…”);
Promise Promise=requestHolder.get();

尝试使用wireshark查看请求是否可疑?