Facebook App: localhost no longer works as app domain

后端 未结 13 1284
我寻月下人不归
我寻月下人不归 2020-11-28 02:33

I\'ve been writing a game for Facebook using Rails and jQuery. Since I started using the Facebook Javascript SDK, using localhost as an app domain seemed to work just fine.

相关标签:
13条回答
  • 2020-11-28 03:03

    You can still test your app without deploying it on a remote sever like heroku. The trick is to update the etc/hosts file this way:

    127.0.0.1 mydomain.com
    

    Then on the Facebook App's settings, type [http://] mydomain.com, without the "[" and "]"

    It worked for me this way

    0 讨论(0)
  • 2020-11-28 03:06

    I ran into an issue with my Rails app that I usually run with http://localhost:3000 because Facebook now requires the Valid OAuth redirect to use https.

    To use https locally, I used [ngrok][1] which allows you to use https by providing a tunnel. To do this:

    1. I went to their website and downloaded their program
    2. I extracted the file for the program
    3. In my console, I went into the directory where ngrok was extracted to and entered 'grok http 3000' on my Windows machine, others may use './grok http 3000'
    4. After entering that, ngrok provided a https address which I put into the Valid OAuth Redirect URIs field in Facebook
    5. Then I started my server and was able to access it using that https address instead of localhost:3000
    0 讨论(0)
  • 2020-11-28 03:07

    Try using the url with port, e.g.

        http://localhost:8000/
    

    I was having the same issue and found this solution right now.

    0 讨论(0)
  • 2020-11-28 03:12

    Solution using Firebase

    In order to get this working on localhost, port 3000 I did the following:

    1. Create App

    1. Now Select "+ Create Test App" from the arrow dropdown (top left).

    1. Add localhost to App Domains

    1. Add http://localhost:3000/ to Site URL by selected "+ Add Platform"

    Up to this point I had followed all previous answers submitted on here, but nothing worked.

    So...

    1. In the left hand menu, select "Add Product"

    2. Add "Facebook Login"

    You will be presented with a workflow carrousel, with defaulted domain http://localhost:3000/, click "continue" until the end.

    1. Select "Facebook Login > Settings" from the Product Menu.

    2. Enter your Firebase OAuth redirect URI (found when enable Facebook Login in your firebase console https://console.firebase.google.com, example below)

    1. Paste URI and Save.

    Done.

    0 讨论(0)
  • 2020-11-28 03:12

    For me it worked like this:

    Configuring the facebook app dashboard:

    *On the ' basic ' tab:

    1) Leaving app domain empty.

    2) Erasing any platform. Meaning: no website no canvas platform. (so no site-URL field to fill)

    *On the 'advanced' tab:

    3) I entered into the Valid OAuth redirect URIs:

    http://localhost/myappfolder/redirect.php
    

    4) regarding my code, insdie my c:/xampp/htdocs/localhost/myappfolder/index.php (this file makes the loginURL):

    $helper = new FacebookRedirectLoginHelper('http://localhost/myappfolder/redirect.php');  
    

    inside the redirect.php file:

    $helper = new FacebookRedirectLoginHelper('http://localhost/myappfolder/redirect.php');  
    

    and I got a session! finally! no need to hang myself in the end :P

    0 讨论(0)
  • 2020-11-28 03:13
    1. Go to your App's settings page in http://developers.facebook.com
    2. Click on the dropdown arrow on the top left (next to the name of your app) and click "Create Test App" and give it a name
    3. In the Settings > Basic of that new Test App set the App Domains as "localhost"
    4. Also set the Website Site URL as "http://localhost:8888" (or whatever port you are using).
    5. IMPORTANT: this app has different App ID and App Secret from your online application. So, last step: make sure that you update the code that sits in your localhost with the Test App's App ID and App Secret. On the contrary, the code that sits in the live server should be using the main App's ID and Secret.
    0 讨论(0)
提交回复
热议问题