Tweetinvi。名称“ CredentialsCreator”在当前上下文中不存在

时间:2018-12-31 05:24:06

标签: c# twitter tweetinvi

使用Tweetinvinuget库添加到我的asp.net application并尝试一个示例之后:

我确保添加references,例如:

using Tweetinvi;
using Tweetinvi.Models;
var applicationCredentials = CredentialsCreator.GenerateApplicationCredentials(ConsumerKey, 
ConsumerSecret);

我收到以下错误:名称'CredentialsCreator'在当前上下文中不存在。

1 个答案:

答案 0 :(得分:1)

这取决于您使用的版本,但是CredentialsCreator是不再使用的旧逻辑。

您现在可以执行以下操作:

new ConsumerCredentials("CONSUMER_TOKEN", "CONSUMER_SECRET")
{
    ApplicationOnlyBearerToken = "BEARER_TOKEN"
};

// or if you want to set the credentials
Auth.SetApplicationOnlyCredentials("CONSUMER_KEY", "CONSUMER_SECRET", "BEARER_TOKEN");

// if you do not have the bearer token and want tweetinvi to retrieve it for you
Auth.SetApplicationOnlyCredentials("CONSUMER_KEY", "CONSUMER_SECRET", true);

希望对您有帮助