How to Test Facebook Connect Locally

2019-01-03 07:56发布

I use ASP .NET and Facebook Connect APIs. but when I run the app and press Connect button it's return to the Website not to the test local server which is (http://localhost:xxxx/test.aspx) So how I can test Facebook locally (i.e How I can change the callback url) ?

标签: facebook
10条回答
Melony?
2楼-- · 2019-01-03 07:59

It's simple enough when you find out.

Open /etc/hosts (unix) or C:\WINDOWS\system32\drivers\etc\hosts.

If your domain is foo.com, then add this line:

127.0.0.1    local.foo.com

When you are testing, open local.foo.com in your browser and it should work.

查看更多
乱世女痞
3楼-- · 2019-01-03 08:00

You don't have to do anything difficult!

Facebook → Settings → Basic:
write "localhost" in the "App Domains" field then click on "+Add Platform" choose "Web Site".

After that, in the "Site Url" field write your localhost url
(e.g.: http://localhost:1337/something).

This will allow you to test your facebook plugins locally.

查看更多
Fickle 薄情
4楼-- · 2019-01-03 08:02

Looks like FB just changed the app dev page again and added a feature called "Server IP Whitelist".

  1. Go to your app and Select Settings -> Advanced Tab
  2. Get your public IP (google will tell you if you google "Whats My IP")
  3. Add your public IP to the Server IP Whitelist and click Save Changes at the bottom
查看更多
淡お忘
5楼-- · 2019-01-03 08:02

Create 2 apps and

In /initializers/env_variables.rb

if Rails.env == 'development'
    ENV['FB_APP_ID'] = "HERE"
    ENV["FB_SECRET"] = "HERE"
else
    ENV['FB_APP_ID'] = "HERE"
    ENV["FB_SECRET"] = "HERE"
end
查看更多
Rolldiameter
6楼-- · 2019-01-03 08:07

Edit your app at www.facebook.com/developers/ and set the "Site URL" to "http://localhost/myapppath".

When done - change it back.

查看更多
\"骚年 ilove
7楼-- · 2019-01-03 08:08

go to canvas page.. view it in browser.. copy the address bar text. now go to your facebook app go to edit settings

in website, in site url paste that address

in facebook integration , again paste the that address in canvas url

and also the same code wherever you require canvas url or redirect url..

hope it will help..

查看更多
登录 后发表回答