Google API Playground †https://developers.google.com/oauthplayground/ Firebase V1 API †セキュリティ †
サンプル情報 †https://blog.nearsoftjobs.com/spring-boot-oauth2-firebase-d8a4bf37ce15 https://qiita.com/mr-hisa-child/items/5ed2ae2fe4c86d4bb5c7 https://github.com/googleapis/google-auth-library-java#google-auth-library-oauth2-http react + firebase †https://qiita.com/zaburo/items/801bd288cec47bd28764 rootでやるとnpmインストール時にパーミッションエラーがでるのでいかを付ける
https://tenderfeel.xsrv.jp/javascript/4403/ 公式jsのドキュメント †https://firebase.google.com/docs/reference/js/firebase.auth.Auth.html#signinwithphonenumber https://firebase.google.com/docs/auth/web/phone-auth?hl=ja Authentication †
https://fir-ui-demo-84a6c.firebaseapp.com/
https://github.com/firebase/firebaseui-web-react/ 設定URL †相変わらずたどり着けないので、プロジェクトIDを調べて直アクセスが良い。 https://console.firebase.google.com/project/プロジェクトID/authentication/providers?hl=ja 承認済みドメイン †
IDトークン検証 †https://firebase.google.com/docs/auth/admin/verify-id-tokens?hl=ja SMS認証 †
認証API †
Google公式ブログ †https://firebase.googleblog.com/2017/11/whats-new-with-fcm-customizing-messages.html レスポンスJSON 異常系 †GoogleAPIの認証がNG †アクセストークンの有効期間はリクエストしてから60分。 { "error": { "code": 401, "message": "Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.", "status": "UNAUTHENTICATED" } } 送信したパラメータ名にエラーあり †{ "error": { "code": 400, "message": "Invalid JSON payload received. Unknown name \"payloads\" at 'message.apns': Cannot find field.", "status": "INVALID_ARGUMENT", "details": [ { "@type": "type.googleapis.com/google.rpc.BadRequest", "fieldViolations": [ { "field": "message.apns", "description": "Invalid JSON payload received. Unknown name \"payloads\" at 'message.apns': Cannot find field." } ] } ] } } 送信したパラメータの中身にエラーあり †
{ "error": { "code": 400, "message": "Request contains an invalid argument.", "status": "INVALID_ARGUMENT" } } 送信API †https://fcm.googleapis.com/v1/projects/プロジェクトID/messages:send 送信JSON †{ "message": { "token": "トークン", "name": "message name", "notification": { "body": "Test message 201711281530", "title": "notification title" } }, "validate_only": true } 有効化 †https://console.developers.google.com/apis/api/fcm.googleapis.com/overview?project=tf-quickstart リクエストを投げてみる †curl -H "Content-type: application/json" -H "Authorization: Bearer トークン" -X POST -d '{ "validate_only": false, "message" : { "token": "test"}}' https://fcm.googleapis.com/v1/projects/[project-id]/messages:send 認証はOAuth2.0 †https://firebase.google.com/docs/cloud-messaging/auth-server?hl=ja トークンの有効期限切れエラー †{ "error": { "code": 401, "message": "Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.", "status": "UNAUTHENTICATED" } } Firebase CLI †npm install -g firebase-tools firebase login とするとブラウザが立ち上がりログイン完了 新しくディレクトリを作り、その中でfirebase initすることで選択できる。。 Hosting †firebase init firebase deploy Analytics †Database †Storage †Crash Reporting †Firebase Cloud Messaging †
http://qiita.com/flatfisher/items/31f5c9e21ae56cccff8d http://inside.pixiv.net/entry/2016/12/03/190000 構成要素 †
送信予約完了してもあくまで送信予約がされたという状態。デバイスがオフラインモードだったりすると送信待ち状態となり、collapsibleの場合はこの時に上書きされる可能性がある。 デバイストークンID †
Curlによる送信 †事前にサーバーキーが必要。
curl -H "Content-type: application/json" -H "Authorization:key=$KEY" -X POST -d '{"to": "ユニークなID","data": {"hello": "This is a Firebase Cloud Messaging Device Group Message!"}}' https://fcm.googleapis.com/fcm/send
curl -H "Content-type: application/json" -H "Authorization:key=$KEY" -X POST -d '{ "data": { "score": "5x1","time": "15:10"},"to" : "デバイストークンID"}' https://fcm.googleapis.com/fcm/send
curl -H "Content-type: application/json" -H "Authorization:key=$KEY" -X POST -d '{ "to": "/topics/foo-bar","data": { "message": "This is a Firebase Cloud Messaging Topic Message!"}}' https://fcm.googleapis.com/fcm/send notification †システム側が表出までハンドリングしてくれるもの。音やらIconやら設定可能 payload †データは任意のものが設定できる代わりに、受信時に自分で処理を記載する必要がある。 GitHub †ブラウザ †https://github.com/firebase/quickstart-js/tree/master/messaging |