Windows phone 7 如何持久化Twitter授权人ITwitterAuthorizer
如何保持Twitter身份验证,使其不需要每次从Windows phone 8应用程序发送推文时都进行身份验证 我通过使用PinAuthorizer使用LINQTOTWITTER sdk 下面是在“PinTextBox.Text”中提供身份验证代码后执行的代码 此PIN授权器用于检查身份验证是否完成。我需要持久化这个对象或使用任何机制,这样用户就不必每次都提供身份验证代码Windows phone 7 如何持久化Twitter授权人ITwitterAuthorizer,windows-phone-7,twitter,windows-phone-8,Windows Phone 7,Twitter,Windows Phone 8,如何保持Twitter身份验证,使其不需要每次从Windows phone 8应用程序发送推文时都进行身份验证 我通过使用PinAuthorizer使用LINQTOTWITTER sdk 下面是在“PinTextBox.Text”中提供身份验证代码后执行的代码 此PIN授权器用于检查身份验证是否完成。我需要持久化这个对象或使用任何机制,这样用户就不必每次都提供身份验证代码 private void AuthenticateButton_Click(object sender, RoutedEve
private void AuthenticateButton_Click(object sender, RoutedEventArgs e)
{
pinAuth.CompleteAuthorize(
PinTextBox.Text,
completeResp => Dispatcher.BeginInvoke(() =>
{
switch (completeResp.Status)
{
case TwitterErrorStatus.Success:
AppSettings.TwitterAuthorizer = pinAuth;
NavigationService.GoBack();
break;
case TwitterErrorStatus.TwitterApiError:
case TwitterErrorStatus.RequestProcessingException:
MessageBox.Show(
completeResp.Error.ToString(),
completeResp.Message,
MessageBoxButton.OK);
break;
}
}));
}
保存成功登录IsolatedStorage后从Twitter获得的访问令牌,并在需要发布tweet时使用相同的访问令牌 您没有提到您在应用程序中使用的Twitter SDK。这取决于您使用的SDK。如果我的答案不能解决您的问题,请使用更多数据更新您的问题 我从未在LINQTOTWITTER上工作过。下面是关于类似问题的讨论。我希望这里提到的解决方案能解决这个问题
pinAuth.CompleteAuthorize(PinTextBox.Text,completeResp=>Dispatcher.BeginInvoke(()=>{开关(completeResp.Status)){case TwitterErrorStatus.Success:AppSettings.TwitterAuthorizer=pinAuth;我已经更新了问题描述,请重新阅读并建议我。