LoginSignup
1
0

More than 1 year has passed since last update.

Facebook認証をlocalhostで

Posted at

Facebook認証でログイン機能を実装する際にlocalhostではどうも弾かれてしまうので、
なにか方法は…と調べたらngrokなるサービスを発見したので備忘録として残します。
どうも、ngrokを通じてlocalhostに届く仕組みらしい。へー凄い。便利。

ngrokのセットアップから起動

公式サイトの記述の通りにインストール

brew install ngrok/ngrok/ngrok

サイトから新規登録して、アクセストークンを取得
登録できたら以下のコマンドで設定

ngrok config add-authtoken <アクセストークン>

早速起動(今回は3000番ポートで起動)

ngrok http 3000

起動するとこんな感じ

ngrok                                                                                                                                                           (Ctrl+C to quit)
                                                                                                                                                                                                                                                           
Join us in the ngrok community @ https://ngrok.com/slack                                                                                                                                                                                                     
                                                                                                                                                                                                                                                             
Session Status                online                                                                                                                                                                                                                         
Account                       *********** (Plan: Free)                                                                                                                                                                                      
Version                       3.1.0                                                                                                                                                                                                                          
Region                        Japan (jp)                                                                                                                                                                                                                     
Latency                       10ms                                                                                                                                                                                                                           
Web Interface                 http://***********                                                                                                                                                                                                          
Forwarding                    https://********************.jp.ngrok.io -> http://localhost:3000                                                                                                                                          
                                                                                                                                                                                                                                                             
Connections                   ttl     opn     rt1     rt5     p50     p90                                                                                           

https://********************.jp.ngrok.io にアクセスするとlocalhostに繋がる。
FirebaseのAuthenticationを使用していたので、承認ドメインに追加して完了。

参考記事

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0