开发者

Auth Session is always null

I've used different methods without success to setup a simple Iframe app that previously works with the old 4.x Facebook C# SDK. I use a regular NET 4.0 web app, I don't use MVC. In my FB app configuration I've enabled all the new methods (like oAuth2) but disabled the options marked as deprecated.

The Authorizer Session is always null with a logged user fan of my page, too.

Authorizer auth = new Authorizer(FacebookContext.Current.AppId, FacebookContext.Current.AppSecret, new HttpContextWrapper(Context));
auth.Perms = "user_about_me,user_birthday,user_location";

if (auth.Session != null && auth.Session.AccessToken != null)
    fbApp = new FacebookClient(auth.Session.AccessToken);           

if(auth.IsAuthorized())
        //show th开发者_StackOverflowe app

Probably I've missing something stupid, but I can't get it to works. I think is something related to the cookie, the difference in my SDK 4.x web.config is the cookieSupport="false" not supported in the facebookSettings... Thanks in advance to the people who can help me :) Joe


In version 5 the cookie is used if it is present in the request, otherwise it will look for other request parameters such as signed_request. You should not be using a cookie with a canvas app as you will run into cross-domain issues with certain browsers.

Ensure you have POST for Canvas enabled.

Instead of using Authorizer try the CanvasAuthorizer class (5.0.3) or FacebookCanvasAuthorizer class (latest source).

Instantiate it like so:

var auth = new CanvasAuthorizer { Perms = "user_about_me,user_birthday,user_location" };

You don't need to pass the appId or appSecret into the constructor as it will be taken from your Web.config section.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜