Facebook SSO is a native extension that allows the use of Facebook Single Sign-On (SSO) functionality. The use of this extension enables an application to automatically use the login token from the Facebook application in the device, if the app was authorized by the user.

The extension can be adjusted to use the Facebook native authorization window when requesting the authorization. If no authorization token is found, it can fall back to Web View login.

Sample

package
{

	import com.afterisk.shared.ane.lib.AndroidSSOEvent;
	import com.afterisk.shared.ane.lib.AndroidSSOInterface;
	import flash.display.Sprite;

	public class SSOExample extends Sprite
	{

		private static var _ssoi:AndroidSSOInterface;
		//The key from your application page on Facebook developer portal (http://developers.facebook.com)
		public static const FACEBOOK_APPLICATION_KEY:String = "yourkeyhere";

		public function SSOExample():void
		{
			_ssoi = new AndroidSSOInterface();
			//Check if Facebook App is installed on the device
			_ssoi.addEventListener(AndroidSSOEvent.INIT_CHECK_COMPLETE, handleInstallCheck, false, 0, true);
			_ssoi.checkIfInstalled();
		}

		private static function handleInstallCheck(e:AndroidSSOEvent):void
		{
			_ssoi.removeEventListener(AndroidSSOEvent.INIT_CHECK_COMPLETE, handleInstallCheck);

			if(e.facebookInstalled)
			{
				//If Facebook app is intalled add listeners to the interface and start the authorization process
				_ssoi.addEventListener(AndroidSSOEvent.NO_SESSION, handleAndroidSSOStatus, false, 0, true);
				_ssoi.addEventListener(AndroidSSOEvent.AUTHORIZED, handleAndroidSSOStatus, false, 0, true);
				_ssoi.addEventListener(AndroidSSOEvent.CANCELED, handleAndroidSSOStatus, false, 0, true);
				_ssoi.addEventListener(AndroidSSOEvent.ERROR, handleAndroidSSOStatus, false, 0, true);
				//Authorization process, setting 2nd parameter to true allows you to use Facebook
				//native authorization UI
				_ssoi.authorize(FACEBOOK_APPLICATION_KEY, true);
			}
			else
			{
				//Fall back to web view login if Facebook application is not installed on the device
			}
		}

		private static function handleAndroidSSOStatus(e:AndroidSSOEvent):void
		{
			if(e.type == AndroidSSOEvent.AUTHORIZED)
			{
				//The application has been authorized, use token to login using your Facebook Actionscript API from Adobe
				//http://code.google.com/p/facebook-actionscript-api/
				trace(e.accessToken);
				trace(e.expiresIn);
			}
			else
			{
				//the authorization was not succesful, retry, fall back to Web View login or do something else.
				trace("Event: " + e.type);
			}
		}
	}
}
Air Native Extension, Android . URL.