在.Net Standard中使用linqtotwitter进行授权

时间:2019-06-26 11:55:27

标签: c# authorization linq-to-twitter

我一直在使用.Net Framework的LinqToTwitter

此后,我已将我的应用程序转换为.Net Standard。

现在尝试使用Twitter授权返回我的应用重定向网址时遇到问题。

.Net Framework中的有效解决方案是-

string redirectUrl = null;

var store = new InMemoryCredentialStore()
{
    ConsumerKey = consumerKey,
    ConsumerSecret = consumerSecret
}; 

AspNetAuthorizer authorizer = new AspNetAuthorizer() { CredentialStore = store };
authorizer.GoToTwitterAuthorization = str => redirectUrl = str;
await authorizer.BeginAuthorizeAsync(callBackUrl);

return redirectUrl;

问题是AspNetAuthorizer中不存在LinqToTwitter.netstandard.dll(我正在使用版本5.0.0-beta2)。

所以我试图重新配置它以使用-

var authorizer = new XAuthAuthorizer() { CredentialStore = store };
await authorizer.AuthorizeAsync();

但这在授权者中没有GoToTwitterAuthorization作为选项。我也尝试了SingleUserAuthorizer,但再次没有选择来获取重定向URL。

如何在.Net Standard中实现这一目标?

0 个答案:

没有答案
相关问题