You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by derChris <ch...@goal-games.de> on 2013/10/02 14:19:38 UTC

Facebook Support in Flex

Hi,

currently my company is develloping an mobile app using apache flex. Today
we had a big problem with facebook as they changed a few things... and the
Login with Facebook was broken.
(see
http://stackoverflow.com/questions/19134277/flash-facebook-api-security-warning-please-treat-the-url-above-as-you)

Out there is an FacebookActionScript-API
https://code.google.com/p/facebook-actionscript-api/ which we are using -
and which isn't updated since about 2 years...

Has anyone an idea why Adobe (see Project History) don't care about that
anymore?

What is the best way to integrate FB into a flex mobile app? Are there any
recommended NativeExtensions? 

 Best regards,

Christian



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Facebook-Support-in-Flex-tp2921.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: Facebook Support in Flex

Posted by derChris <ch...@goal-games.de>.
Actually we went to the GoViral - ANE from Milkman Games. It works pretty
well on iOs and Android, uses the official SDKs, is much more comfortable
for programmer and user... but costs a few $... But its worth ...

See http://www.milkmangames.com/blog/tools/
Adobe (written by Alex from Milkman) has some tutorials how to use it



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Facebook-Support-in-Flex-facebook-actionscript-api-broken-Facebooks-October-2013-Breaking-Changes-tp2921p3638.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: Facebook Support in Flex

Posted by Simon Briche <sb...@free.fr>.
Hi,

Thanks for your solution, it works well for me (tested with Samsung Nexus S
/ Android 4.1.2 / AIR 3.9). However I've made some changes to your code :

1. in function handleLocationChange : 
     loginCallback(FacebookDataUtils.getURLVariables(location), null);  
instead of 
     loginCallback(true, null); 
so I can retreive the access_token

2. public static var LOGIN_SUCCESS_URL_MOBILE:String 
    public static var LOGIN_SUCCESS_SECUREURL_MOBILE:String 
instead of
    public static var LOGIN_URL_MOBILE:String 
    public static var LOGIN_SECUREURL_MOBILE:String 

3. If you're targeting a version of flash player > 11, don't forget to use
the native JSON.stringify() and JSON.parse() instead of the
com.adobe.serialization.json.JSON.encode() and
com.adobe.serialization.json.JSON.decode() version. You have to make the
update in several classes of the source API.

++




--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Facebook-Support-in-Flex-facebook-actionscript-api-broken-Facebooks-October-2013-Breaking-Changes-tp2921p3635.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: Facebook Support in Flex

Posted by derChris <ch...@goal-games.de>.
FYI

The problem is that in the facebook air sdk there is a constant: 

public static var LOGIN_SUCCESS_URL:String 
      = 'http://www.facebook.com/connect/login_success.html'; ...

and in MobileLoginWindow of the sdk: 

protected function handleLocationChange(event:Event):void 
                { 
                        var location:String = webView.location; 
                        if
(location.indexOf(FacebookURLDefaults.LOGIN_FAIL_URL) == 0 ||
location.indexOf(FacebookURLDefaults.LOGIN_FAIL_SECUREURL) == 0) 
                        { 
                                webView.removeEventListener(Event.COMPLETE,
handleLocationChange); 
                               
webView.removeEventListener(LocationChangeEvent.LOCATION_CHANGE,
handleLocationChange); 
                                loginCallback(null,
FacebookDataUtils.getURLVariables(location).error_reason); 
                                userClosedWindow =  false; 
                                webView.dispose(); 
                                webView=null; 
                        } 

                        else if
(location.indexOf(FacebookURLDefaults.LOGIN_SUCCESS_URL) == 0 ||
location.indexOf(FacebookURLDefaults.LOGIN_SUCCESS_SECUREURL) == 0) 
                        { 
                                webView.removeEventListener(Event.COMPLETE,
handleLocationChange); 
                               
webView.removeEventListener(LocationChangeEvent.LOCATION_CHANGE,
handleLocationChange); 
                               
loginCallback(FacebookDataUtils.getURLVariables(location), null); 
                                
                                userClosedWindow =  false; 
                                webView.dispose(); 
                                webView=null; 
                        } 
                } 

As facebook is now sending
"http://m.facebook.com/connect/login_success.html" 

this is not working anymore... So it has nothing to do with the Flex or Air
SDKs... 


To fix it:

1. download the source of the api...
2. add to FacebookURLDefaults.as

public static var LOGIN_URL_MOBILE:String
		   = 'http://m.facebook.com/connect/login_success.html';

   public static var LOGIN_SECUREURL_MOBILE:String
		   = 'https://m.facebook.com/connect/login_success.html';

3. change MobileLoginWindow.as

protected function handleLocationChange(event:Event):void
		{
			var location:String = webView.location;
			if (location.indexOf(FacebookURLDefaults.LOGIN_FAIL_URL) == 0 ||
location.indexOf(FacebookURLDefaults.LOGIN_FAIL_SECUREURL) == 0 ||
location.indexOf(FacebookURLDefaults.LOGIN_URL_MOBILE) == 0 ||
location.indexOf(FacebookURLDefaults.LOGIN_SECUREURL_MOBILE) == 0)
			{
				webView.removeEventListener(Event.COMPLETE, handleLocationChange);
				webView.removeEventListener(LocationChangeEvent.LOCATION_CHANGE,
handleLocationChange);
				loginCallback(null,
FacebookDataUtils.getURLVariables(location).error_reason);
				userClosedWindow =  false;
				webView.dispose();
				webView=null;
			}

			else if (location.indexOf(FacebookURLDefaults.LOGIN_SUCCESS_URL) == 0 ||
location.indexOf(FacebookURLDefaults.LOGIN_SUCCESS_SECUREURL) == 0  || 
location.indexOf(FacebookURLDefaults.LOGIN_SECUREURL_MOBILE) == 0 || 
location.indexOf(FacebookURLDefaults.LOGIN_URL_MOBILE) == 0)
			{
				webView.removeEventListener(Event.COMPLETE, handleLocationChange);
				webView.removeEventListener(LocationChangeEvent.LOCATION_CHANGE,
handleLocationChange);
				loginCallback(FacebookDataUtils.getURLVariables(location), null);
				
				userClosedWindow =  false;
				webView.dispose();
				webView=null;
			}
		}

4. Build SWC and replace the old one

Christian



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Facebook-Support-in-Flex-facebook-actionscript-api-broken-Facebooks-October-2013-Breaking-Changes-tp2921p2941.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: Facebook Support in Flex

Posted by Tom Chiverton <tc...@extravision.com>.
On 02/10/2013 14:01, derChris wrote:
> For us this wasn't working...
>
>
I wouldn't have expected it to :-)
FYI for everyone else, FaceBook have updated the URLs used, and Chris 
has listed the fixed ones on StackOverflow.

Tom

Re: Facebook Support in Flex

Posted by derChris <ch...@goal-games.de>.
For us this wasn't working...



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Facebook-Support-in-Flex-facebook-actionscript-api-broken-Facebooks-October-2013-Breaking-Changes-tp2921p2933.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: Facebook Support in Flex

Posted by Sumudu Chinthaka <cs...@gmail.com>.
Hi

I had the same problem and update the Flex SDK to 4.10.0 and Air SDK to 3.8
solve the problem

Regards
Sumudu




On Wed, Oct 2, 2013 at 5:49 PM, derChris <ch...@goal-games.de>wrote:

> Hi,
>
> currently my company is develloping an mobile app using apache flex. Today
> we had a big problem with facebook as they changed a few things... and the
> Login with Facebook was broken.
> (see
>
> http://stackoverflow.com/questions/19134277/flash-facebook-api-security-warning-please-treat-the-url-above-as-you
> )
>
> Out there is an FacebookActionScript-API
> https://code.google.com/p/facebook-actionscript-api/ which we are using -
> and which isn't updated since about 2 years...
>
> Has anyone an idea why Adobe (see Project History) don't care about that
> anymore?
>
> What is the best way to integrate FB into a flex mobile app? Are there any
> recommended NativeExtensions?
>
>  Best regards,
>
> Christian
>
>
>
> --
> View this message in context:
> http://apache-flex-users.2333346.n4.nabble.com/Facebook-Support-in-Flex-tp2921.html
> Sent from the Apache Flex Users mailing list archive at Nabble.com.
>