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");
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With