【发布时间】:2018-10-11 20:25:05
【问题描述】:
我正在尝试使用我的应用程序实现 Xamairn Auth。我已经从https://www.nuget.org/packages/Xamarin.Auth 安装了 nuget 包。
按照他们的示例,我在共享项目中有以下代码。
public void SaveCredentials (string userName, string password)
{
if (!string.IsNullOrWhiteSpace (userName) && !string.IsNullOrWhiteSpace (password)) {
Account account = new Account {
Username = userName
};
account.Properties.Add ("Password", password);
AccountStore.Create ().Save (account, App.AppName);
}
}
在 android 上运行时,它会保存用户名和密码,但我在控制台中收到以下消息:
"此版本不安全,因为默认密码。 请使用提供 AccountStore 密码的版本。 AccountStore.Create(Context, string) 或 AccountStore.Create(string);"
我尝试将参数传递给 AccountStore.Create() 方法,但它似乎没有接受。像这样的:
#if ANDROID
_accountStore = AccountStore.Create(Application.Context);
#else
_accountStore = AccountStore.Create();
#endif
我是否需要编写特定于 android 的代码来扩展 create 方法。
【问题讨论】:
标签: xamarin oauth xamarin.forms xamarin.auth