Working with Facebook login from localhost

前端 未结 9 2108
无人及你
无人及你 2020-12-09 08:29

I have a React/Horizon app with facebook login. I am wondering if there is any option to work with facebook login from localhost?

相关标签:
9条回答
  • 2020-12-09 09:02

    If you're using react and your local server is on http and still getting the error run this in the terminal to start up an https localhost

    Windows:
    set HTTPS=true&&npm start

    Windows Powershel:
    ($env:HTTPS = "true") -and (npm start)

    Linux and macOS (Bash):
    HTTPS=true npm start

    when it opens in the browser click Advanced and proceed

    0 讨论(0)
  • 2020-12-09 09:11

    After test I see that we don't need to setup anything in facebook app (even Site URL don't need to be localhost)

    Just need to use https://localhost instead of http://localhost. Then login work and we able to receive response.

    Note: If you see SSL warning after you enter https://localhost to browser. Just click on Advance -> Process to ... (unsafe)

    0 讨论(0)
  • 2020-12-09 09:13

    So in my case doing the following things worked for me.

    1. Make sure your application is in development mode

    1. Make sure you don't have anything in Valid OAuth Redirect URIs when working from localhost

    1. Make sure you don't have anything in App Domains also

    1. Make sure you have entered localhost in your site url

    0 讨论(0)
  • 2020-12-09 09:13

    You can use a tunneling tool like https://ngrok.com/ which is free for at least one instance. Then you can create a test App as already suggested and use the ngrok generated urls in this test app.

    0 讨论(0)
  • 2020-12-09 09:14

    I would like to add an update: July 2019

    Facebook now allow localhost automatically in development mode and it is blocked in production mode. All you have to do is turn on development mode in your app settings and you are good to go.

    You do not need to add localhost as a redirect URL anymore.

    Here you can see the error at the Redirect URLs when I'm trying to add localhost.

    0 讨论(0)
  • 2020-12-09 09:14

    So I also have problem with working with Facebook Login from localhost in React and Express and I got this info: "The method FB.login can no longer be called from http pages". After click login button, app just crashed. My solution to fix this mess, was delete Facebook cookie from this localhost page. After this, I still have this error about http, but I can proceed and test login options.

    Other solution is working in incognito mode.

    0 讨论(0)
提交回复
热议问题