开发者

Facebook authorization in C#

How do I implement a Facebook authorization? I have no idea where to start. 开发者_Python百科I have seen numerous examples in PHP but none in C#.


Start here: http://developers.facebook.com


If you can use the Facebook javascript sdk (Much easier IMO, and you have asp.net as a tag so i am making assumptions) you could try something like this:

//Facebook iFrame include
window.fbAsyncInit = function () {
    FB.init({ appId: YourID, status: true, cookie: true, xfbml: true });
    FB.Canvas.setAutoResize();
    authorize();

}

/*
* Facebook Authorization
*/
function authorize (){
    FB.getLoginStatus(function (response) {
        if (response.session) {
            // logged in and connected user, carry on
        } else {
            // no user session available, Lets ask for perms
            FB.ui(
            {
                method: 'permissions.request',
                perms: your permissions
            },
            function (response) {
                if (response && response.session != null) {
                    //User accepted permissions
                } else {
                   //User did not accept permissions
                }
            });
        }
    }); 
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜