开发者

devdefined OAuth IConsumerRequest error

I'm getting this error:

"For the RSASSA-PKCS1-v1_5 signature method you must use the constructor which takes an additional AssymetricAlgorithm "key" parameter"

when I try to make a request with 开发者_StackOverflowmy IOAuthSession object.

I assume its referring to IOAuthSession constructor but IOAuthSession doesn't have a "key" parameter in the constructor.

Here's my code:

IOAuthSession consumerSession = new OAuthSession(consumerContext, requestTokenUrl,     UserAuthoriseUrl, accessTokenUrl);

   IConsumerRequest getOrganisationRequest = consumerSession
            .Request()
            .ForMethod("GET")
            .ForUri(new Uri("https://api.xero.com/api.xro/2.0/Organisation"))
            .SignWithToken(accessToken);

Any Help will be much appretiated.


I think that error message is wrong, there is no constructor overload that takes a key.

That said I believe what's wrong is you are failing to assign the key to the consumer context:

You should have something like this:

var consumerContext = new OAuthConsumerContext
{
  ConsumerKey = "weitu.googlepages.com",
  SignatureMethod = SignatureMethod.RsaSha1,
  Key = certificate.PrivateKey // this is what you're missing
};

IOAuthSession consumerSession = new OAuthSession(consumerContext, requestTokenUrl,     UserAuthoriseUrl, accessTokenUrl);

...

Let me know if that helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜