tuty_fruity
tuty_fruity

Reputation: 547

spring boot social cannot connect to facebook via localhost

I'm trying to use spring-boot-starter-social-facebook to connect to facebook and print my profile name, but i dont understand why it failed.

FacebookController.java

enter image description here

/connect/facebookConnect.html

enter image description here

then on developer.facebook.com, i configured my app like this . .

enter image description here

enter image description here

I also set the appid and appsecret in applicationProperties. then when i try to run and press 'connect', the browser loads for ~10secs and then in Spring Tool Suite's console it prints . . .

Exception while handling OAuth2 callback (I/O error on POST request for "https://graph.facebook.com/v2.3/oauth/access_token":Connection timed out: connect; nested exception is java.net.ConnectException: Connection timed out: connect). Redirecting to facebook connection status page.

i pasted the link in the browser and it says

{
   "error": {
      "message": "Missing redirect_uri parameter.",
      "type": "OAuthException",
      "code": 191,
      "fbtrace_id": "ClbUIsKtnXt"
   }
}

i think i messed up configuring testapp in facebook.

SiteURL = http://localhost:8080/

Valid Oauth redirect = http://localhost:8080/connect/facebook

what should i do? thank you in advance.

Upvotes: 1

Views: 1566

Answers (3)

sodik
sodik

Reputation: 4683

Try add localhost to app domains - my setting:

enter image description here

Upvotes: 2

GETYOU
GETYOU

Reputation: 11

You should filled in Domains not localhost , like this enter image description here

and you can configuration you System file hosts turn to 127.0.0.1 for local testing.

Upvotes: 0

vaquar khan
vaquar khan

Reputation: 11449

You need to give IP address instead of local host.

Following link you can find same information

Facebook app - login through omniauth - OAuthException 191

Upvotes: 0

Related Questions