I'm at the first stage of trying to communicate with Twitter using DotNetOpenAuth. Whenever I call this method I receive the following error:
ProtocolException occured The remote server returned an error: (403) Forbidden.
public string SendConsumerAuthentication()
{
ServiceProviderDescription serviceProvider = GetServiceDescription();
string applicationKey = settingsManager.GetApplicationKey(className);
string applicationSecret = settingsManager.GetApplicationSecret(className);
// decouple this in future
InMemoryTokenManager inMemoryTokenManager = new InMemoryTokenManager(applicationKey, applicationSecret);
var consumer = new DesktopConsumer(serviceProvider, inMemoryTokenManager);
string uri = string.Empty;
string requestToken = string.Empty;
var requestArgs = new Dictionary<string, string> {
//need to pass this as extra, but leave the value blank
{ "oauth_token", string.Empty}
};
//request access
try
{
uri = consumer.RequestUserAuthorization(requestArgs, null, out requestToken).AbsoluteUri;
}
catch (Exception)
{
uri = null;
}
return uri;
}
I wonder what i'm missing?