0

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 my 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.

Bittercoder
  • 11,753
  • 10
  • 58
  • 76
Martinffx
  • 2,426
  • 4
  • 33
  • 60

1 Answers1

0

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.

Bittercoder
  • 11,753
  • 10
  • 58
  • 76
  • Thanks for your response, I think my problem is that the asp.net user account I'm using on the shared web server doesn't have access permissions for the private key on my certificate, so the consumercontext doesn't have a set key value. certificate.PrivateKey.KeySize returns object ref not set to an instance of the object, so when i try make a request it gets a null value from the consumercontext for the key. I've spoken to my isp about changing my access levels for the certificate. – Martinffx Nov 07 '10 at 18:54