如何在 Xamarin.iOS Azure Mobile App 中存储帐户信息?
How to store account information in Xamarin.iOS Azure Mobile App?
我使用 Twitter 在 Azure 移动应用程序中对用户进行身份验证。我想把账号信息保存在phone上,这样用户就不用每次启动app都要重新登录了。这是一个 Xamarin.iOS 应用程序。
如果我要构建一个 Windows 应用程序,我会按照 the Azure Mobile Apps documentation under "Caching the authentication token" 中的说明使用 PasswordVault。
如果我使用 Xamarin.Auth,我会使用 AccountStore
,如 the Xamarin.Auth documentation under "Storing and Retrieving Account Information on Devices" 中所述。
我看到 Azure 移动应用程序 SDK 包含 a modified version of the Xamarin.Auth plugin。我可以那样使用 AccountStore
吗?
如果没有,在 Xamarin.iOS 中保存帐户信息的最佳方式是什么?
答案是使用 iOS 钥匙串。我忘了 Xamarin.Auth 是开源的。以下是它存储帐户的方式:
https://github.com/xamarin/Xamarin.Auth/blob/master/src/Xamarin.Auth.iOS/KeyChainAccountStore.cs
还有一个来自 Xamarin 的钥匙串示例:
https://github.com/xamarin/monotouch-samples/blob/master/Keychain/Main.cs
我使用 Twitter 在 Azure 移动应用程序中对用户进行身份验证。我想把账号信息保存在phone上,这样用户就不用每次启动app都要重新登录了。这是一个 Xamarin.iOS 应用程序。
如果我要构建一个 Windows 应用程序,我会按照 the Azure Mobile Apps documentation under "Caching the authentication token" 中的说明使用 PasswordVault。
如果我使用 Xamarin.Auth,我会使用 AccountStore
,如 the Xamarin.Auth documentation under "Storing and Retrieving Account Information on Devices" 中所述。
我看到 Azure 移动应用程序 SDK 包含 a modified version of the Xamarin.Auth plugin。我可以那样使用 AccountStore
吗?
如果没有,在 Xamarin.iOS 中保存帐户信息的最佳方式是什么?
答案是使用 iOS 钥匙串。我忘了 Xamarin.Auth 是开源的。以下是它存储帐户的方式:
https://github.com/xamarin/Xamarin.Auth/blob/master/src/Xamarin.Auth.iOS/KeyChainAccountStore.cs
还有一个来自 Xamarin 的钥匙串示例:
https://github.com/xamarin/monotouch-samples/blob/master/Keychain/Main.cs