로컬로 Facebook Connect를 테스트하는 방법
ASP .NET 및 Facebook Connect API를 사용합니다. 그러나 응용 프로그램을 실행하고 연결 버튼을 누르면 테스트 로컬 서버가 아닌 웹 사이트 ( http : // localhost : xxxx / test.aspx )로 돌아갑니다 . 따라서 Facebook을 로컬로 테스트하는 방법은 무엇입니까? 콜백 URL)?
당신이 알아낼 때 충분히 간단합니다.
/etc/hosts
(유닉스) 또는을 엽니 다 C:\WINDOWS\system32\drivers\etc\hosts
.
도메인이 foo.com 인 경우 다음 줄을 추가하십시오.
127.0.0.1 local.foo.com
테스트 할 때 local.foo.com
브라우저에서 열면 작동합니다.
www.facebook.com/developers/ 에서 앱을 편집 하고 "사이트 URL"을 "http : // localhost / myapppath"로 설정하십시오.
완료되면 다시 변경하십시오.
https://developers.facebook.com/apps 에서 테스트 응용 프로그램 (개발 환경 전용)을 만들고 localhost : [port] 설정으로 Website with Facebook Login
속성을 설정하는 것이 좋습니다. 이 옵션은 호스트를 변경할 필요없이 잘 작동합니다. 시작한 후에 는 appId 를 프로덕션 앱으로 다시 변경 해야합니다.
편집 -최신 fb 버전에서는 settings
탭 아래에 있습니다.
Facebook에는 테스트 버전 기능이 추가되었습니다.
먼저 애플리케이션의 테스트 버전을 추가 하십시오. 테스트 앱 작성
그런 다음 Website 아래 에서 사이트 URL 을 " http : // localhost "로 변경하고 변경 사항 저장을 누르 십시오.
That's all, but be careful: App ID and App Secret keys are different for the application and its test versions!
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.
Facebook seemingly randomly disables the ability to set localhost as a domain on your facebook app. I found the easiest work around was to tunnel my localhost to the web. This can be done for free using http://progrium.com/localtunnel/ or with a custom url (easier since you don't have to change url everytime in facebook) https://showoff.io
I couldn't use the other solutions... What worked for me was installing LocalTunnel.net (https://github.com/danielrmz/localtunnel-net-client), and then using the resulting url on Facebook.
Looks like FB just changed the app dev page again and added a feature called "Server IP Whitelist".
- Go to your app and Select Settings -> Advanced Tab
- Get your public IP (google will tell you if you google "Whats My IP")
- 서버 IP 화이트리스트에 퍼블릭 IP를 추가하고 하단에서 변경 사항 저장을 클릭하십시오.
캔버스 페이지로 이동합니다. 브라우저에서 볼 수 있습니다. 주소 표시 줄 텍스트를 복사하십시오. 이제 페이스 북 앱으로 이동하여 설정 수정으로 이동
웹 사이트, 사이트 URL에 해당 주소 붙여 넣기
페이스 북 통합에서 캔버스 URL에 해당 주소를 다시 붙여 넣으십시오.
또한 캔버스 URL 또는 리디렉션 URL이 필요한 곳마다 동일한 코드를 사용하십시오.
도움이 되길 바랍니다 ..
2 개의 앱을 만들고
에서 /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
참고 URL : https://stackoverflow.com/questions/2459728/how-to-test-facebook-connect-locally
'IT' 카테고리의 다른 글
새로운 레일 대 생성 (0) | 2020.05.13 |
---|---|
해시 및 범위 기본 키란 무엇입니까? (0) | 2020.05.13 |
jquery 3.0 url.indexOf 오류 (0) | 2020.05.13 |
모든 Git 명령을 시작할 때“git”을 입력하지 않으려면 어떻게해야합니까? (0) | 2020.05.13 |
많은 수의 쉼표를 추가하는 데 유용한 방법이 있습니까? (0) | 2020.05.13 |