Here is what I want to:
I used OAuth 2.0 authorization system.
I already registered my application in Facebook, and I have got my application secret keys (i did server side code, but I need more user friendy authorization system).
Based on response from Facebook, how can I get response code from Facebook without reloading the page? In case you didn’t understand what I mean take a look on next example:
Example is on this link:
http://www.badminton.si/1-turnir-b-kategorije-1-kolo-mbl
How can I then continue to get my access token so I can access my private information (like email)?
IN SHORT:
<script type="text/javascript" src="../Scripts/jquery-1.4.1-vsdoc.js"></script>
<script type="text/javascript" src="http://connect.facebook.net/en_US/all.js"></script>
<script type="text/javascript" src="http://static.ak.fbcdn.net/connect/en_US/core.debug.js"> </script>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
FB.init({
appId: my_api_key,
status: true,
cookie: true,
xfbml: true
});
FB.Event.subscribe('auth.login', function (response) {login();)}
FB.Event.subscribe('auth.logout', function (response) {logout();});
FB.getLoginStatus(function (response) {if (response.session) {login();}});
function login() {FB.api('/me', function (response) {alert(response.email)});
....
<fb:login-button v="2" size="large" autologoutlink="true" perms="email,user_birthday,status_update,publish_stream,read_stream">
</fb:login-button>
Just follow the examples on http://developers.facebook.com/docs/authentication/
On most of the functions you’ll get callbacks that you can catch to get a token without having to reload the page.
From the documentation:
With the
response.sessionobject you should get everything you need without having to reload the page.