如何在 Xamarin.Forms 中登录 Facebook [英] How to log in to Facebook in Xamarin.Forms

查看:30
本文介绍了如何在 Xamarin.Forms 中登录 Facebook的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想制作一个 Xamarin.Forms 项目,面向 iOS、Android 和 Windows Phone.

I want to make a Xamarin.Forms project, targeting iOS, Android and Windows Phone.

我的应用需要使用 Facebook 对用户进行身份验证.

My app needs to authenticate users using Facebook.

我应该为每个平台单独实现登录,还是使用手动流程?https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow/v2.0

Should I implement login for each platform independently, or use a manual flow? https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow/v2.0

我更喜欢登录流程的单一实现,并在所有平台上使用它.

I prefer to have a single implementation of the login flow, and use it on all platforms.

如何获得 Facebook 登录流程的单一实现?

How can I get a single implementaion of the Facebook login flow?

推荐答案

您可以使用 Xamarin.社交Xamarin.Auth.无论平台是什么,它都允许使用相同的 API.

You could consume either Xamarin.Social or Xamarin.Auth for that. It allows using the same api whatever the platform is.

截至目前,这些库还不是 PCL,但您仍然可以从共享资产项目中使用它们,或者在接口中抽象您需要的 API 并使用 DependencyService 或任何其他 DI 容器.

As of now, those libs aren't PCL yet, but you still can consume them from a Shared Assets Project, or abstract the API you need in an interface and inject in with DependencyService or any other DI container.

这篇关于如何在 Xamarin.Forms 中登录 Facebook的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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