针对Facebook身份验证方案的xamarin Auth [英] xamarin Auth for facebook authentication scenarios

查看:79
本文介绍了针对Facebook身份验证方案的xamarin Auth的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用xamarin开发应用程序.在这里,我正在使用xamarin auth组件进行Facebook身份验证.我能够登录并获取用户信息并将其保存在本地DB.Xamarin auth组件提供了用于存储帐户对象的选项这样,当用户重新启动应用程序时,我们可以使用该帐户对象进行登录.

I am developing an application using xamarin.Here I am using xamarin auth component for facebook authentication.I am able to login and get users info and able to save them in local DB.Xamarin auth component has provided option for storing account object so that when user relaunch app ,we can use that account object to login.

这是我的问题:如果用户从站点更改Facebook帐户上的密码,那么在重新启动应用程序时应该怎么做,因为存储的帐户是本地帐户,因此我们无法使用该信息再次登录.

Here comes my question: If user changes password on facebook account from site then what should be done when app is relaunching,as stored account is local we can't use that info to login again.

谢谢. 任何建议表示赞赏.

Thanks. Any suggestions are appreciated.

推荐答案

实际上,您应该在首次成功身份验证后使用access_token对Facebook进行后续查询.使用OAuth,您将不会在应用程序中存储密码.我希望当用户在Facebook中更改密码时,旧的access_token可能会过期.在这种情况下,您必须使用户手动重新登录.无论如何,当access_token出于任何原因过期时,都是这种情况;请记住,所有access_token都会在一段时间后过期.

Actually you are supposed to use the access_token for subsequent queries towards Facebook after the first successful authentication. With OAuth, you won't store password in your app. I would expect that when a user changes the password within Facebook, the old access_token might expire. In this case, you'll have to make the user manually re-login. This is the case anyhow when your access_token expires for any reason; keep in mind that all access_tokens expire after some time.

您可以通过在后台发送一些基本请求来轻松验证access_token是否仍然有效.如果您收到autherror响应,则在应用程序流程有意义时,只需提示用户再次登录即可.

You can easily verify if the access_token is still valid by sending some basic request in the background. If you get an autherror response, just prompt the user to login again when it makes sense in the flow of your app.

这篇关于针对Facebook身份验证方案的xamarin Auth的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆