Yngve Moe
Yngve Moe

Reputation: 510

What redirection URI should I supply to FacebookConnect?

I am trying to log in to Facebook with a com.codename1.social.FacebookConnect object. However, after entering the correct username and password I am taken to a page with the following error message:

Redirection Error - You are receiving this error for one of the following reseasons (sic): - Your redirection is to another redirection record. This can cause a loop and is not allowed in our system. - You may have recently removed your HTTP Redirection then your DNS is already changed on the name server but your system (computer) still has this IP (the redirection IP) cached. Please give this up to one hour before it is completely removed from your local cache.

This has been tested in the simulator and on an iPhone 6 that hasn't got the FB app installed.

I have more or less followed the example at http://www.programcreek.com/java-api-examples/index.php?source_dir=codenameone-demos-master/SignIn/src/com/codename1/demos/signin/SignIn.java. In essence:

com.codename1.social.FacebookConnect fbc = com.codename1.social.FacebookConnect.getInstance();
fbc.setClientId("my_app_id");
fbc.setClientSecret("my_secret");
// fbc.setOauth2URL("https://www.facebook.com/dialog/oauth"); // Is this necessary? It doesn't seem to make a difference.
fbc.setRedirectURI("what_should_i_enter_here?");
fbc.setCallback(whatever);
fbc.doLogin();

The redirect URI that I have been using is listed under "Valid OAuth redirect URIs" on the Facebook app settings page (Advanced/Client Settings). What am I doing wrong?

Upvotes: 1

Views: 77

Answers (1)

Diamond
Diamond

Reputation: 7483

If not already created, go to your Facebook developer dashboard and add website platform.

The URL you entered here would be your RedirectURI. For examle, if your website url is www.example.com, enter http://www.example.com/ (Note the forward slash at the end).

Your URL should exist in some cases and you can use any URL.

Upvotes: 1

Related Questions