How to setup facebook app for localhost?

1.1k Views Asked by At

Today, I've been trying to setup facebook app for localhost and I couldn't find the right solution for it. It was working in the past and I don't know what facebook updated with it...

Here's what I did:

  1. I've created test app from one of my public app

  2. In settings, I set site domain as "localhost" and site url as "http://localhost:8888/"

  3. In settings/advanced, I set Valid OAuth redirect URIs as "http://localhost:8888/" again.

And when I try to login, I got the error message like below:

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

Also I have public ip for my localhost and I tried to set it instead of localhost like "http://xx.xxx.xxx.xx:8888/" but it's still not working.

I'm really embarrased because it was working before. Can someone please help me out with this ?

Thanks in advance.

1

There are 1 best solutions below

0
On

Here are the steps that worked for me getting my local app working with Facebook:

Part I:

  • goto developers.facebook.com
  • Hover over the "MyApp" drop-down to the right and click "Add an app" or click [Create an APP] if that is the only option you see.
  • Click "Settings" to the top left
  • copy 'App Id' and 'Secret Id' to FACEBOOK_APP_ID and FACEBOOK_SECRET_ID in your .env file
  • enter the app domain (eg: localhost or yourappname.app, etc.)
  • click [+ Add Platform] button on the bottom of the screen and then choose "Website". Enter http://localhost:8000
  • click [Save Changes]

Part II:

  • click [+Add Product] to the bottom left
  • choose Facebook Login
  • Click on "Settings" underneath "Facebook Login"
  • Enter your callback URL under Valid OAuth redirect URIs (eg: http://localhost:8000/login/facebook/callback)
  • Turn on OAuth login for your desired allowed device types
  • Click [Save Changes]

Part III:

  • click "App Review" near the top left of the screen
  • switch the "Make [your app name] public?" slider to "Yes"