Facebook login only works when hosts are set to localhost?

Sorry, I keep getting this error:

{
   "error": {
      "message": "Invalid redirect_uri: Given URL is not allowed by the Application configuration.",
      "type": "OAuthException",
      "code": 191
   }
}

The login works, however, when my file /etc/hostsmatters: 127.0.0.1 [mysite].rhcloud.comit does not work when I look at the actual one [mysite].rhcloud.com.

I am running the same application (on another server) locally as the one I am running on rhcloud. In particular, local local directories of web applications are synchronized.

URL Information

When you try to log in remotely, the URL looks like this: and fails with the above error:

https://graph.facebook.com/oauth/authorize?scope=user_photos%2Cfriends_photos&redirect_uri=http%3A%2F%2F [mypublicipaddress]% 2Fuser% 2Flogin & response_type = code & client_id = [hidden]

URL- ; :

https://www.facebook.com/dialog/permissions.request?app_id= [] & = & = HTTP% 3A% 2F% 2F [].rhcloud.com% 2Fuser% 2Flogin & response_type = & = user_photos% 2Cfriends_photos & fbconnect = 1

+5
4

, , , , , , redirect_uri "URL- -" "/"?

, redirect_uri "/" ( ..) ,

+1

URL- URL/ facebook. , . , , URL .

0

Yes. It ends /. Just check your fields and add this trailing /if it is not there.

But honestly, this is the first time I have seen something like this. Usually we see that Facebooklogins do not work in the local environment, but they work fine.

0
source

I managed to solve exactly the same problem by contacting my facebook developer application account and changing the domain from localhost to the URL of my application

0
source

All Articles