您可以在文件上注册您的 AccessToken 并重复使用它。
我已将 fb 客户端包装在 Singleton 对象中并使用此代码
if (!string.IsNullOrEmpty((string)Windows.Storage.ApplicationData.Current.LocalSettings.Values["AccessToken"]))
{
FbClient.Instance.AccessToken = (string)Windows.Storage.ApplicationData.Current.LocalSettings.Values["AccessToken"];
Frame.Navigate(typeof(FBHomePage));
}
else
{
var s = FbClient.Instance.Login(); //as Sdk example...
}
FbClient.Instance.LoginSucced += Instance_LoginSucced;
并在 Instance_LoginSucced
void Instance_LoginSucced(object sender, EventArgs e)
{
Windows.Storage.ApplicationData.Current.LocalSettings.Values.Add
(
new KeyValuePair<string, object>("AccessToken", FbClient.Instance.AccessToken)
);
Frame.Navigate(typeof(FBHomePage));
}