I am working on a Facebook application And I am offering the user to invite his friend to the application using the C# SDK. as shown in Facebook documentation
My problem is when the friend of the user receive the application request and click Accept it does not show the application permission request page
.
Do I need to preform any extra step to redirect the user to the application permission request page
?
i found the solution
i start ask for permission on my application canvas page and if user accept, redirect to the same page with query string. not perfect solution but it works fine
In case if you are using http://facebooksdk.codeplex.com/ with MVC3 at the app main page controller you should provide redirection for non-authorized users:
var fbWebContext = FacebookWebContext.Current;
if (fbWebContext.IsAuthorized() && fbWebContext.UserId > 0)
{
try
{
var fb = new FacebookWebClient(fbWebContext);
dynamic result = fb.Get("/me");
}
catch (FacebookOAuthException)
{
var redirectString = string.Format("https://graph.facebook.com/oauth/authorize?client_id={0}&redirect_uri={1}&type=user_agent&display=page&scope={2}",
Facebook.FacebookApplication.Current.AppId,
FacebookWebContext.Current.Settings.CanvasPage,
"email, publish_actions"
);
Response.Redirect("redirectString");
}
}
You need to ask the user for the permission as seen on http://developers.facebook.com/docs/reference/dialogs/oauth/ . How did you get the permissions of the first user who is inviting the friend? You can redirect him to that page or the page which handles the app request clicks can check the application permissions. If the user doesn't grant a permission, you will easily ask him for them.
You should always check the permissions, because even the user already using your application can revoke them.
By default, accepting a Facebook application request redirects a user to the application's main page. If your application requires Facebook permissions to view the main page, you would want to check that all visitors have accepted your permissions and redirect them to the OAuth permissions dialog if they have not. Note that's Facebook documentation suggests deleting the accepted request after the user visits your application, through the request_ids
parameter that is sent in the query string.
What do you mean by application permission request page ? Is that the one where the user authorizes the third party application to access his facebook data?
I agree with the other answer. After a user clicks the app request notification icon from within his facebook account he gets redirected to the application's canvas page, the request includes a list of the request_ids generated by your application
Within your application, after reading the facebook request_ids, you can request facebook about the received request_ids and then decide what to do with that information, you can pass an additional data parameter in order to provide extra information about how was the app request generated.
Finally you can redirect the user to whatever page you want based on the information that you got.
Hope this helps
you should check if the user is accesing your app from a request... if the request_ids parameter is present. If so you should redirect the user to a page where permissons would be asked and a list of outstanding requests shown!
来源:https://stackoverflow.com/questions/7384804/how-to-handle-facebook-application-requests