Has anybody used freelancer.com api? I am not able to even retrieve the requestToken for it. I want it for android. I tried using the signpost library, but it gives the following error
oauth.signpost.exception.OAuthNotAuthorizedException: Authorization failed (server replied with a 401). This can happen if the consumer key was not correct or the signatures did not match.
I am using the correct consumer key. The 开发者_运维百科same method works successfully for twitter.
Late reply, but did you get it to work? So, it works for Twitter, but not Freelancer? One thing I've found with freelancer, is that it does not take the OAuth parameters if they are sent in the header. You will need to provide the OAuth parameters either in the GET or POST. Twitter on the other hand recommends that these parameters be sent via the header.
Earlier versions of signpost only implement OAuth Parameters in the header. The freelanecer.com api expects the parameters to be in the query string. The latest version of Signpost can now implement OAuth parameters in the query string.
Here is the relevant code from the service builder:
/**
* 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();
精彩评论