Every API needs authentication, yet no developer wants to deal with authentication. Simple Auth embeds authentication into the API so you dont need to deal with it. Most importantly it works great with traditional Xamarin and Xamarin.Forms
https://www.nuget.org/packages/Clancey.SimpleAuth/
Simple auth ships with some built in providers so you just need to add your keys and scopes.
varscopes=new[]{"https://www.googleapis.com/auth/userinfo.email","https://www.googleapis.com/auth/userinfo.profile"};varapi=newGoogleApi("google","clientid","clientsecret"){Scopes=scopes,};varaccount=awaitapi.Authenticate();Restful Api Requests couldnt be simpler
varsong=awaitapi.Get<Song>("http://myapi/Song/",songId);[Path("/pet")][ContentType("application/json")][Accepts("application/json")]publicvirtualTaskAddPet(Petbody){returnPost(body);}The webview is automatically displayed for you. If you want to handle displaying it your self you can!
Api.ShowAuthenticator=(authenticator)=>{varinvoker=newFoundation.NSObject();invoker.BeginInvokeOnMainThread(()=>{varvc=newiOS.WebAuthenticator(authenticator);//TODO: Present View Controller});};One password support is for iOS Only.
Simply add the project or the Nuget
https://www.nuget.org/packages/Clancey.SimpleAuth.OnePassword/
Then call the following line in your iOS project prior to calling api.Authenticate();
SimpleAuth.OnePassword.Activate();Native Facebook support is for iOS Only.
Simply add the project or the Nuget
https://www.nuget.org/packages/Clancey.SimpleAuth.Facebook.iOS/
The Facebook SDK requires you modify your info.plist : https://components.xamarin.com/gettingstarted/facebookios
Then call the following line in your iOS AppDelegate FinishedLaunching method;
SimpleAuth.Providers.Facebook.Init(app,options);Also add the following override in your AppDelegate
publicoverrideboolOpenUrl(UIApplicationapplication,NSUrlurl,stringsourceApplication,NSObjectannotation){if(SimpleAuth.Providers.Facebook.OpenUrl(application,url,sourceApplication,annotation))returntrue;returnbase.OpenUrl(application,url,sourceApplication,annotation);}