有人使用过freelancer.com api吗?我甚至无法为它检索requestToken。我要给android用。我尝试使用路标库,但是它给出了以下错误
oauth.signpost.exception.OAuthNotAuthorizedException:授权失败(服务器回复为401)。如果使用者密钥不正确或签名不匹配,则可能发生这种情况。
我使用的是正确的消费者密钥。同样的方法在twitter上也很成功。
发布于 2011-05-04 07:29:06
很晚才回复,但你把它拿到工作了吗?所以,它适用于Twitter,但不适用于自由职业者?我在自由职业者中发现的一件事是,如果OAuth参数被发送到标头中,它就不会接受这些参数。您需要在GET或POST中提供OAuth参数。另一方面,Twitter建议通过头发送这些参数。
发布于 2011-06-08 17:32:11
早期版本的signpost仅在标头中实现OAuth参数。freelanecer.com api需要查询字符串中的参数。最新版本的Signpost现在可以在查询字符串中实现OAuth参数。
以下是服务构建器的相关代码:
/**
* Configures the signature type, choose between header, querystring, etc. Defaults to Header
*
* @param scope The OAuth scope
* @return the {@link ServiceBuilder} instance for method chaining
*/
public ServiceBuilder signatureType(SignatureType type)
{
Preconditions.checkNotNull(type, "Signature type can't be null");
this.signatureType = type;
return this;
}
Service = new ServiceBuilder()
.provider(FreelancerApi.class)
.apiKey(consumer)
.apiSecret(secret)
.callback("oob")
.signatureType(SignatureType.QueryString)
.build();https://stackoverflow.com/questions/5526460
复制相似问题