Facebook connection/communication with AS3 only? - facebook

the title pretty much sums it up. Is it possible to establish a connection with facebook using flash AS3 "only", without having to work with Javascript, html, iframes or any other externals.
The reason is a simple game I was making for android using AdobeAir that connects with facebook for leaderboard purposes. Works quite well, ofcourse with AdobeAir you get the flash internal webview and ANEs to help with the facebook communication. But outside AdobeAir, as a simple web-aimed swf file you dont.
Since I was hoping to make a web-version of the game and upload it to game-hosters, I was wondering if there is a way to make a connection and wrap it up in a single swf file, since thats what these sites want for upload.
Hopes are slim, yet I would appreciate any help on this!

You need some kind of web interface to load the authorisation dialogue from Facebook. This is a popup with content running within Facebook itself, if the user then authorises your app Facebook will send a callback where you can get the access_token.
This is explained rather rudimental, the point being is that the authorisation is on Facebook ends, this is the security. In AIR you use StageWebView, in a browser you load the authorisation URL in a popup, this is implemented in the Javascript SDK for you.
You can put a button in Flash, use ExternalInterface to call methods in the Javascript SDK and send the access_token back as a callback. If you have the access_token you can use AS3 to make API calls with it in the form of HTTP requests.

Is your application a Facebook App? If your SWF is running inside the Facebook Canvas, of course it is more convenient to get the login information directly through official Javascript SDK, but if you want, this may help you. https://code.google.com/p/facebook-actionscript-api/

Any request you can write in JS, you can code in AS3 also. I don't see any problems, since FaceBook has 100% documented API.

Related

Full Facebook PHP SDK app (no JS SDK). Is it even possible?

In my work we often need to build Facebook apps in the form of Facebook Canvas and Website. These apps are available on Facebook direclty (an iframe) and as mobile versions (outside Facebook, in the browser).
We are working with a code base which mixes Facebook JS SDK (authentication and authorization) with PHP SDK (API calls). I find it rather dirty, and not easy to understand for people freshly working on the projects.
It's inconvinient to make API calls with JS, and making them with PHP forces extending access tokens. Authenticating user with JS SDK involves client-side redirects which are ugly to be honest, as they usually occur moments after the current page starts rendering, and so on...
I googled a lot about separating these two SDKs but did not find a clear answer to my questions:
Is it possible to create Facebook app (Canvas, Website) which bases ONLY on PHP SDK? Check login status, login, permissions, making API calls, etc. Would signed request be enough?
Is JS SDK the only full-proof way to determine user's login status at any time?
This link seems to describe what I'm thinking of, however the docs are rather brief (which seems to be a problem of Facebook documentation in general). Can anyone suggest other sources that might help? Does anyone have experience with builing FB aplications based only on server-side?
Thanks.
EDIT:
The link I posted above covers the case of not using ANY SDK, so no, it's not what I'm looking for.
You can even create an App WITHOUT any SDK - with simple CURL calls, for example. So yeah, it is indeed possible to use the PHP SDK only, but the login process is much better with the JS SDK (no redirection needed) and you can´t auto-refresh a user session like it is possible with FB.getLoginStatus afaik.
In short, i would not recommend it, the JS SDK is the very best way to authorize users and refresh Access Tokens. I would only use the PHP SDK (or simple CURL calls) for stuff that MUST happen on the server, and for stuff that includes using the App Secret, for example.

Differentiating between Google Analytics Tracking of Facebook App and Web App

I have a web app at www.mydomain.com/webapp and its set up with Google Analytics. I create a facebook app at apps.facebook.com/webapp and iframe in the above url.
Is there a way to distinguish activity of users on facebook from users on mydomain?
Thanks for any help and direction you can give me.
You could use JavaScript to determine that your page is displayed in an iframe – but that would also be true if maybe other sites embedded your page.
A better way would be to check for the [signed_request][1] parameter that gets POSTed to your app on initial load into the iframe. (If you were paranoid about someone “faking” that, you could also verify the signed_request.)
Once you figured out that your page was actually loaded inside Facebook, it should be easy to execute the appropriate JS code to send that info to Analytics.

Standalone Flash application + Facebook

So here is the thing...
I need a standalone flash application that receives by socket an image and then publishes it on facebook.
The few methods i've seen use php but in this case i really would like to use only the standalone.
Ideas on how to accomplish this? Is it possible?
What you're trying to do can be accomplished from the client without server scripting as well.
Have a look on these links
http://code.google.com/p/facebook-actionscript-api/
http://www.adobe.com/devnet/facebook.html
It's an AS facebook api and the Adobe site has some very useful examples on how to set this up.
After you achieve a login and you have a working connection to the Fb api then you can upload your picture to the user's albums using the api from within AS.

Twitter Callback Issue Using Titanium OAuth Client for Android

I'm using the following Titanium OAuth Client for a Share with Twitter feature in our Android app:
https://github.com/jeremyspouken/Titanium-OAuth-Client
The client works till the PIN Code screen. Then, if I have a callback URL defined in my Twitter App settings, it will redirect the user to that URL.. which I don't want. I read elsewhere that to disable the callback, to set oauth_callback=oob, which also is undesirable as it closes the Twitter screen after the PIN Code screen without having done anything.
Can someone help me understand what's the point of callback in Twitter oAUTH for mobile application, and how to make it work with my Titanium Andoid mobile app? I am about to pull my hair out.
Redirect url can come in handy if you say want to promote your app or want the user who logs in to twitter via your app.
e.g for say angry birds, if you login to twitter then the redirect url can be say the angry birds twitter page.
you can prevent the closing of the web view by simply removing the call that destroys authorize UI from your oauth_adapter file.
not sure if this helps you. just let me know the comments if it does or not.

Do I need a library for Codeigniter to create a Facebook application?

Do I need an entire library to crate a Facebook app with Codeigniter? I have not made an app for Facebook before the the developer documentation looked simiple. Beyond using my "secret" id for my app what else would I need to do to send my output via my view back to the facebook canvas? Are things more complicated than they seem? Don't I just output to my view as normal except things go to the canvas? Thanks.
No, you do not need a library. You can make all requests to the Facebook Graph api using cURL or any other method to call urls. However using the Facebook PHP SDK does help, it has a lot of helper methods that you'll find useful, do check this link to the documentation for the sdk, it's helpful.Hope this answer helps you.
p.s: And yeah you just output to your view as any other web app
No, you do not need a library, but it will make the process much smoother and take care of a lot of baseline functionality that you will need.
You might checkout my post here to see exactly how to integrate the offical facebook SDK within a codeigniter application as a stand alone library...