lloydphillips
lloydphillips

Reputation: 2855

Facebook Authorise with Facebook SDK

I'm using the Facebook SDK on a .net 4 MVC 2.0 website. I've managed to get everything set up ok as per the sample app and I can go to my facebook app page and see my page. However when going to the About page I've been asked to allow my application to access my details, which I did, then the page just redirects to my Index page. If I click on the About tab and debug the application the About Action never gets called, it's always the Index Method.

Here's the About Method on the controller:

[FacebookAuthorize()]
public ActionResult About()
{
    //Some code in here
}

So, I tried to removing the FacebookAuthorise attribute and I got this error:

(OAuthException) An active access token must be used to query information about the current user.

Have I set something up wrong somewhere whereby the cookie isn't being read or the authorisations can't take place? I've got the enable cookie set to true in the web.config for the facebookSettings.

Upvotes: 1

Views: 861

Answers (1)

Nate Totten
Nate Totten

Reputation: 8932

You shouldn't be using the FacebookAuthorize attribute inside an iframe app. You should use CanvasAuthorize. Authorization is different depending on if you are in a iframe or a regular web app. Change that and it should work correctly.

Upvotes: 4

Related Questions