In this article, I am going to share with you what is xamarin.auth and xamarin.facebook, what is the difference between xamarin.auth and xamarin.facebook and how to use both xamarin component in xamarin.forms project.
Nowadays, everyone is connected via social sites anywhere in the world, As we know that one of the best social sites is Facebook. Due to this popularity for Xamarin mobile apps, it becomes very easy to signup or sign in using Facebook rather than registering manually on different native mobile apps.
Let’s look at here.
Xamarin.Auth helps to developer for authenticate users via standard login mechanisms (it is OAuth 1.0 and 2.0), and storing user data too. It’s also simple and add support for non-standard authentication schemes. Xamarin.auth library support cross-platform like android,ios,window etc. so once you learn it on windows than you easily set for another device eg. Android,ios etc.
Xamarin.auth generally use for authenticating user like “facebook, twitter, google etc.
You can easily download xamarin.auth from xamarin component as well as a nuget package.
2. Xamarin.facebook (native)
Apart from #1, you need to find out what you want if you need only facebook login with your app (because of it’s give more feature than xamarin.auth it’s also login with installed facebook app on client devices) than i recommend you to use xamarin.facebook native it’s available on xamarin components and also nuget packages like.
You can installing package from following
- Android: https://www.nuget.org/packages/Xamarin.Facebook.Android
- IOS: https://www.nuget.org/packages/Xamarin.Facebook.ios
For android and ios, there are many package available on nuget before installing you must need to check your which version is suitable for your app.
Using xamarin.facebook.android and xamarin.facebook.ios you can easily login with your installed facebook app.
Following is the difference between xamarin.auth and xamarin.facebook (native).
|1||Facebook app installation is optional.||Facebook App must be installed on Device (as per developer.facebook.com guideline )|
|2||Xamarin.auth uses webview for authentication. Which means that user will be prompted to login on facebook.com website within webview of your app.||Xamarin.facebook support native authentication and as fallback it implements webview as well.|
Please read below how native Facebook authentication works.
|4||Xamarin.Auth helps to developer for authenticate users via standard login mechanisms (e.g. OAuth 1.0 and 2.0) and storing user data into device also.||Integrate with Facebook to help to developer build engaging social apps and get more installs. The Facebook Android and ios SDK includes many features to allow you to integrate social within your app.|
|5||You can use xamarin.auth for Twitter, Facebook, Google, LinkedIn, or any other social sign in which supports OAuth protocol.||Only provides authentication for Facebook|
|6||Requires FB Developer Account. And FB developer App with proper configuration.||Requires FB Developer Account. And FB developer App with proper configuration.|
|7||It’s not support login via Facebook installed app on device.||It will allow the Facebook SDK integration to properly identify installed Facebook apps to perform an app switch. So you can easily login with installed Facebook add on device.|
How Facebook Native Authentication works in Xamarin Mobile App Development ?
Facebook native authentication mechanism requires that user of app must have installed Facebook app on their device and they are logged in. ideally Facebook app doesn’t require to login every-time we open FB app. So what native Authentication does is that it asks FB app to provide authentication token which is being used by FB app.
This way it our app can obtain authentication token from existing Facebook app, which is already logged. If your app requires more permissions to read FB profile data then FB app will prompt user to grant permissions to our app.
I hope you enjoyed reading this article, feel free to share and like. 🙂
If you don’t know how to integrate Facebook native social sign into Xamarin.forms then please read my article HERE.