Hey guys,
I seem somewhat confused with how something like Xamarin.Auth will fit into a Xamarin.Forms project.
I understand having to create a renderer in iOS and Android for the login and so forth. Thats cool and working. However my problem has to do with the Accounts structure in Xamarin.Auth. Such as I thought I would be able to call Accounts from my main PCL project and it would work fine across all platforms.
However I get a unsupported platform error when running the code, for example running my Forms application for Android. Is this a usual result ? I am confused as to why it wouldnt just use the Android define and run fine if selected Android project to run. Any ideas ?
I mean isnt this why there is a Xamarin.Auth portable library and libraries for iOS and Android so that it is cross platform... Or will this not behave as I would have thought with Forms ?
Posts
Xamarin.Auth isn't actually structured that well for Xamarin.Forms, as there is no portable library that contains the core
Account
and other classes. Instead they are in a regular .NET assembly (see screenshot) so if you are trying to reference this assembly from a PCL or from an iOS or Android application that is probably the reason. Those files are all file-linked into the iOS and Android assemblies (and sadly there's no existing Windows Phone code with a platform-specific authentication UI yet).A quick test indicates the core code isn't quite ready to be made portable - a couple of classes like
BinaryFormatter
and others inSystem.Cryptography
aren't available in PCL Profile 78. These problems could probably be solved withDependencyService
if you wanted to take a crack at it (since Xamarin.Auth is open source). This would then enable theAccount
s and other classes to be accessible in your PCL.Bringing features from our existing open-source projects into Xamarin.Forms is something that we'd love to do over time, but for now Xamarin.Auth doesn't work "out of the box" with Xamarin.Forms.
ahhh ok, at least I now have a better idea of how it works....
thanks for the info... much appreciated... I might have a bit of a play and see if I can make it work better with Xamarin.Forms..
I was looking for the same thing, here I found a working solution in the meantime http://www.joesauve.com/using-xamarin-auth-with-xamarin-forms/
Oh thats awesome, thanks for the link!!