Omniauth-facebook login not working

社会主义新天地 提交于 2019-12-04 13:41:21

Running local server in HTTPS mode can be useful many times, not just only for the facebook api.

Though, Rails still do not provide an easy way to run rails server in SSL mode. But there're several ways to achieve that:

Use thin server instead of puma/webrick rails default one

thin server allows you to run your application in SSL mode with a minimum effort:

Edit config/application.rb and add:

config.force_ssl = true

Start thin server:

$ thin start --ssl

See full info about that here: How to enable SSL for Rails development environment in two minutes?

Use http tunnel tools like ngrok

Tools like ngrok allow you to create a tunnel form your localhost to the Internet with ease - it also creates both http:// and https:// endpoints for you:

$ rails s -p 3000
$ ./ngrok http 3000

ngrok by @inconshreveable                                                                                                                                            (Ctrl+C to quit)

Session Status                online                                                                                                                                                 
Session Expires               7 hours, 59 minutes                                                                                                                                    
Version                       2.2.8                                                                                                                                                  
Region                        United States (us)                                                                                                                                     
Web Interface                 http://127.0.0.1:4040                                                                                                                                  
Forwarding                    http://2608e936.ngrok.io -> localhost:3000                                                                                                             
Forwarding                    https://2608e936.ngrok.io -> localhost:3000    

Copy the generated url (like https://2608e936.ngrok.io and use it to access your local server.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!