Skip to content

Sample source code for successful Firebase custom authentication when the front-end and back-end ports are different is available.

License

Notifications You must be signed in to change notification settings

IDaaS0/firebase-custom-auth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

firebase-auth-custom-token

フロントエンドとバックエンドのポートが異なる場合に、Firebaseのカスタム認証を成功させるサンプルソースコードを公開しています。

認証フロー

  1. Slackログインアクションでポップアップを開く
  2. ポップアップでSlackログインをしてバックエンドサーバーにリダイレクト
  3. リダイレクトURLのCodoを抽出してAccess Tokenを発行する
  4. Access Token発行時にuser_idを受け取るのでそれをCustom Tokenのuidに利用する
  5. Custom TokenをRedirectの際にCookie設定して期限10sで受け渡す
  6. ポップアップ側でCookieを受け取りカスタムログインをしてポップアップを閉じる
  7. 親のWindowをリロード してログイン済み状態に移動する

動作確認済みブラウザ

Name Version
Chrome 92.0.4515.159
Firefox 88.0.1

実装までに参考にした資料

Firebase Authenticationを使ってFlutter製アプリにYahoo! JAPAN IDでログインしてみる

Instagram で Firebase ユーザーを認証する

JavaScript でカスタム認証システムを使用して Firebase 認証を行う

About

Sample source code for successful Firebase custom authentication when the front-end and back-end ports are different is available.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published