JavaScript SDK auto log me in - facebook

I am trying to see if something is possible.
If I am updating my website to act as a proxy for me and want to know if there is any way to access myself via Open Graph when someone comes to my site without having me needing to literally log myself in?
I was only hoping to leverage the JavaScript SDK; not looking to have a back-end if possible.

You could embed an access token in your javascript code but this is pretty unsafe because other users could look at your source code and use this token themselves. A much safer way would be to do this with server back-end code.

Related

Working with the SoundClound API without application registration

At the moment (and for a long time now, as far as I know) there is no way to register an app on SoundCloud. I need to use their API to access public tracks. JavaScript is used. But I always get a 401/403 error response from the server.
As far as I understand, now it is possible to work only after authentication. But for that you need to register the application.
Tell me, is it possible to access API without application registration? I looked through the threads I found, but didn't see a clear answer. SoundCloud support didn't help at all either.

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.

Can I include Facebook login/API calls *without* hosting my web application online?

I'm having some trouble understanding the steps I need to take in order to make basic requests to the Facebook API. I've been reading the documentation, and having a play with the Graph Explorer, however I'm a little confused getting started.
I'm making a game application for a University submission, for which Facebook integration is a small but important part. I will be submitting this application on disk, and it will need to work when the HTML page is launched from this disk - this is where I'm getting a little stuck. I'm not sure if I'm overthinking this, but I seem to need to register as a Facebook Developer and set up an application domain. Is this necessary? I won't be able to host this application online, it will have to be submitted on disk.
So, my questions are -
Is it possible to include basic Facebook integration without hosting the application online? (Login, retrieval of a list of the user's friend's ids)
(If this is possible) what do I need to do to handle the basic 'setup' of Facebook integration? I've been looking at the Javascript SDK reference and I see I need to have my appId and channelUrl for the Loading and Initialization. I see the appId quite clearly in the App Dashboard, however it is the channelURL I am having trouble with.
I hope that makes sense :) Loading and initializing the framework and then making Graph API calls seems pretty straightforward - I'm just not sure if it's possible without hosting the application online.
Cheers!
Your page should at least be reachable via HTTP – so put a portable webserver (could be a portable Apache distribution, or something smaller) on your “disk” as well, and run your app using http://localhost/…. Add that same address (protocol and domain only, no path) in your app settings for “Website with Facebook login”.
And for the channelUrl, see https://developers.facebook.com/blog/post/2011/08/02/how-to--optimize-social-plugin-performance/

Twitter API: OAuth vs. xAuth

1) Is it true that if you would like to have your custom dialogues to enter twitter user details that you cannot use OAuth to do that?
2) I looked at MGTwitterEngine and now I'm wondering whether it is really necessary to have more than 20 classes just to send a status update.
3) I used to use Basic Auth which worked just fine. It was very little code. Is there a way to modify that code so that it just works again?
Many thanks for your help.
You'll need to apply for xAuth from Twitter with a decent enough reason for them to allow you to use it. That will allow you to take the user's username & password using your own UI and get a token that way instead of going the web-route and directing them to a web auth page.
You'll most probably need to re-write a bunch of your basic auth methods to include all the OAuth signatures and headers into your requests. It'll be nice if they make the switch to OAuth 2 soon, it's much much easier.
I've written my own Twitter engine that uses XAuth and it's relatively simple (apart from the OAuth 1 garbage!). However it'll probably be best to use MGTwitterEngine if you're going the normal OAuth route. I'm not familiar with it but I hear good things. It depends on how you're going to use the API. Writing a simple wrapper probably won't be to hard if you're just interested in calling a few methods. It's just the OAuth 1 stuff that can get complicated; however Twitter's documentation on that is very good indeed.
If you only need to post to twitter, take a look at getsharekit.org it will save you a lot of the hassle with the integration
As for xAuth or oAuth if your application UI is heavily customised it can be well worthwhile applying for xAuth ,as your users all of a sudden will not come across twitters login pages, which are unlikely to be in keeping with the rest of your applications UI. However if your application is mainly a utility application, you will most likely be fine with the oAuth method which is easier as you do not need to apply to twitter for them to enable it

How to get facebook data from app?

I'm writing a sort of visualization desktop (non-web) application, just for fun.
However, ideally I'd want it to be able to pull information from the user's facebook account. (after getting its credentials, of course)
What's the best way to do this? Should I register a new 'facebook app' even though I'm not really making it web-based? I've never written a facebook app before.
I'm using Java as my prog language, btw.
Thanks!
Yes. Facebook supports desktop applications, but they must go through a special authentication mechanism. Essentially, the user will need to be directed to facebook through a web browser window as part of the authentication process.
Here is the documentation on the authentication process: http://wiki.developers.facebook.com/index.php/Login_Desktop_App
There is a relatively polished Java library for facebook here: http://code.google.com/p/facebook-java-api/
If the Java library above does not meets your needs, you can build an implementation on your own. Essentially, you will need to interact with the Facebook REST server, as described at the top of the page here: http://wiki.developers.facebook.com/index.php/API
Edit: After doing some more research I have a few more resources to provide:
Here is a list of some applications written using Java for facebook:
http://wiki.developers.facebook.com/index.php/Facebook_apps_written_in_Java
And there's even a neat desktop application that is open source here:
http://code.google.com/p/fb-photo-uploader/
Good luck!