Firebaseを理解するためにウェブチャットのサンプルを試す

Flutterを使ったアプリ開発のバックエンドとしてFirebaseを検討しているときの覚書。

環境: Windows 10 64bit

チュートリアルに従って単純なチャットアプリを試してみる。
Codelabsにチュートリアルがまとまっている。


個人的にウェブが得意なので、今回はこちらのチュートリアルを進める


チュートリアルが分かりやすいので特に書くことはない。(笑)

「7. Set up user sign-in」のGoogleログインするときに下記エラー
Error: restricted_client
Application: Friendly Chat Web
You can email the developer of this application at:
This app is not yet configured to make OAuth requests. To do that, set up the app’s OAuth consent screen in the Google Cloud Console.
このIssuesを参考にGoogle Cloud Platform(GCP)のFirebase用に作ったプロジェクトを選択、
APIとサービス→認証情報
を開いて、OAuth同意画面のロゴにpublic\images\にあるfirebase-logo.pngを指定(何でもいい)で保存。
これで動いた。


「11. Show notifications」では下記エラーでdevice tokenを取得できなかった。
Unable to get messaging token. FirebaseError: Messaging: We are unable to register the default service worker. Failed to register a ServiceWorker: A bad HTTP response code (404) was received when fetching the script. (messaging/failed-serviceworker-registration).
localhostでhttpsの環境でないからかもしれない。
深く調べてない。

何となく分かってきた。
他のチュートリアルも進めてみる。


【関連記事】