Hi All,
I am using Facebook connect API to grab my friendlist. It redirects me to the login page.
but when I provide credentials it throws an error something like this;
API Error Code: 100
API Error Description: Invalid parameter
Error Message: Requires valid next URL.
Here is the code;
//my actual values are mentioned in the key
_fbService.ApplicationKey = "KEY";
_fbService.Secret = "Key";
_fbService.IsDesktopApplication = false;
string sessionKey = Session["Facebook_session_key"] as String;
string userId = Session["Facebook_userId"] as String;
// When the user uses the Facebook login page, the redirect back here will will have the auth_token in the query params
string authToken = Request.QueryString["auth_token"];
if (!String.IsNullOrEmpty(sessionKey))
{
_fbService.SessionKey = sessionKey;
_fbService.UserId = userId;
}
else if (!String.IsNullOrEmpty(authToken))
{
_fbService.CreateSession(authToken);
Session["Facebook_session_key"] = _fbService.SessionKey;
Session["Facebook_userId"] = _fbService.UserId;
Session["Facebook_session_expires"] = _fbService.SessionExpires;
}
else
{
Response.Redirect(@"http://www.Facebook.com/login.php?api_key=" + _fbService.ApplicationKey + @"&v=1.0");
}
if (!IsPostBack)
{
// Use the FacebookService Component to populate Friends
//MyFriendList.Friends = _fbService.GetFriends();
MyFriendlist.Friends = _fbService.GetFriends();
}
Does anyone knows how to get rid of this? Thanks in advance.