0

I'm trying to develop an app on windows phone 8.0, and I want to add a feature to send a friend request, having the id. I followed the URL Redirect instructions right here. https://developers.facebook.com/docs/reference/dialogs/friends/

I wrote this code:

private void Button_Click(object sender, RoutedEventArgs e)
{
    string site = "https://www.facebook.com/dialog/friends/?id=bicicletas.ikatch&app_id=458358780877780&redirect_uri=https://mighty-lowlands-6381.herokuapp.com/";
    Browserfb.Navigate(new Uri(site, UriKind.Absolute));
}

I changed the app id for my developer app id, and I really dont know where to url redirect, I just put www.facebook.com. So when i ran the app, the facebook UI appears, and I press the button to send the request, and it just gives me a http 500 internal server error. Anyone has a fix on this? Thank you

Sahil Mittal
  • 20,697
  • 12
  • 65
  • 90

1 Answers1

0

I think what you use for the redirect url don't matter, what you need to do is just register for the the Navigating event on the web browser and cancel the navigation:

void browser_Navigating(object sender, NavigatingEventArgs e)
    {
        if (e.Uri == myRedirectUri)
        {
            e.Cancel = true;
            //Send friend request succcess
            //....
        }
    }
Benoit Catherinet
  • 3,335
  • 1
  • 13
  • 12
  • Thank you for your answer Benoit! I tried your code, and realized that actually it never redirects to the URL I specified. Putting some flags, I noticed that the moment I press the Confirm button (to make friends) the uri host is m.facebook.com and the path is /friends/submit and right there I get the http 500 internal error. Thanks for the help, Im really stuck right now with this! – Guille Dufort Sep 14 '13 at 16:51
  • what if you remove the redirect_uri parameter? – Benoit Catherinet Sep 14 '13 at 17:15
  • When you remove the redirect_uri parameter, it directly doesn't work. Facebook requires you to put it. Im really doubting it can be done from windows phone. – Guille Dufort Sep 15 '13 at 20:32
  • Did you try putting a valid uri, there is actually no page at https://mighty-lowlands-6381.herokuapp.com/ – Benoit Catherinet Sep 15 '13 at 20:37
  • Otherwise did you try to see if http://facebooksdk.net/docs/phone/ were supporting add friend? – Benoit Catherinet Sep 15 '13 at 20:50