Firebase FCM HTTP legacy suddenly stop working - firebase

By some unknown reasons, within 3 weeks ago, I suddenly cannot send notification to Google Firebase FCM. Before that, it worked well and all clients can receive notifications normally after I push something to FCM.
I did that by POST a request to https://fcm.googleapis.com/fcm/send
Headers are Content-Type: application/json, Authorization: key=AAAAKFe-...oRpS. The key got from settings liked in this link image
Body liked this
{
"to": "dmx5JJ...dnPb7",
"data": {
"title": "title",
"alertId": 1276318267,
"alertMappingId": 1238716233,
"data": "hehehe"
}
}
with "to" is idToken retrieve from web client.
Google returned success HTTP response, but its content is AuthenticationError:
{"multicast_id":5347538896185294090,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"AuthenticationError"}]}
Did I made any mistakes? Or Google Firebase just changed some policies? Someone please help me with this :'(
PS: I tried switch to HTTP v1, but still got similar result :'(
{
"error": {
"code": 401,
"message": "Auth error from APNS or Web Push Service",
"status": "UNAUTHENTICATED",
"details": [{
"#type": "type.googleapis.com/google.firebase.fcm.v1.FcmError",
"errorCode": "THIRD_PARTY_AUTH_ERROR"
}]
}
}

I found this's maybe a bug happened in Firefox only. Above code still works well in Chrome or Edge.
There're an issue liked this too:
FCM onMessage not working in Firefox, but working in chrome

Related

Create google chat space using api from postman

\`Hi,
I am trying to create a space in google chat using api. So, for this I have configured OAuth2.0 and following details.Method: spaces.create" post methodHTTP Request: "https://www.googleapis.com/auth/chat.spaces.create"Authorization Scopes: "https://www.googleapis.com/auth/chat.spaces.create"I could able to generate the access token but I am not sure about request body however I configured as follows:
*{
"name": "POC Test SPACE",
"spaceType": "DIRECT_MESSAGE",
"singleUserBotDm": "false",
"threaded": "false",
"displayName": ""
}
For this the response as follows:
"error": {
"code": 404,
"message": "Method not found.",
"status": "NOT_FOUND"
}
Actually our requirement is to send notifications on google chat using gmail id in place of sending emails.
Can anyone please suggest where/what I am missing or do I need to do in another way !!!
Regards,
Vamshi.
per this article you have to be a member of the developer preview program to have access to this feature.
https://developers.googleblog.com/2022/05/Create%20Spaces%20and%20Add%20Members%20with%20the%20Google%20Chat%20API.html

Is that possible to add android app to firebase project programmatically using firbase cloud function

Is there any method to add a android app to exiting firebase project programmatically and i need the google-services.json as result then i need to add sha key with that same app using node-js
online documentation not solve my problem or i don't understand how to do it from that documentation
Thankyou for your answer i flowed it and facing another issue
#admin and #Frank van Puffelen please check
when i try to create android it showing this error.
{ "error": { "code": 400, "message": "Request contains an invalid argument.", "status": "INVALID_ARGUMENT" } }
I send post request from live api test window
and in parent i set it as `projects/343202254462`
{ "displayName": "testing", "name": "te4sting", "packageName": "io.asdasd.fdsfdsf", "projectId": "324324324", "appId": "wdeqwe" }
There is a REST api, Firebase Management API, which lets you control the apps connected and other such admin work. Friendly note, make sure you restrict all client api keys from using this api!
REST Resource: v1beta1.projects.androidApps
create POST /v1beta1/{parent=projects/*}/androidApps

Firebase Cloud Messaging tokens stop working - 404 NOT FOUND

We have a problem where Firebase Cloud Messaging tokens seem to have stopped working. We register with Firebase when the application first starts-up and then we call an API to store the token on our server.
We upgraded the app last night and checked that a sample of devices successfully registered themselves and that we could send messages.
Today, however, some calls to Firebase from our server are returning:
{
"error": {
"code": 404,
"message": "Requested entity was not found.",
"status": "NOT_FOUND",
"details": [
{
"#type": "type.googleapis.com/google.firebase.fcm.v1.FcmError",
"errorCode": "UNREGISTERED"
}
]
}
}
These calls are using the same tokens as last night. Half are working and half not.
We don't have any code that explicitly unregisters our app. What else might have caused this issue?
The app is written in C#/Xamarin and we're using CrossGeek's plugin for Firebase.
Thanks,
J.

FCM messaging responding with 503 consistently

I recently implemented FCM messaging as a means to perform push notifications to a Cordova based application. My system sends 100-1000 push notifications a day to individual users.
I'm contacting the FCM Messaging service using the FcmSharp library. https://github.com/bytefish/FcmSharp which as far as i can tell is using the FCM HTTP v1 API.
$"https://fcm.googleapis.com/v1/projects/{settings.Project}/messages:send"
So far it seem to be running ok. Yet i am continuously getting errors logged from the service that sends the messages to FCM indicating that there was a failure.
"error": {
"code": 503,
"message": "The service is currently unavailable.",
"errors": [
{
"message": "The service is currently unavailable.",
"domain": "global",
"reason": "backendError"
}
],
"status": "UNAVAILABLE"
}
The message i am sending (to FCMSharp) also appears to be formatted correctly:
message: {
"validate_only":false,
"message":{
"data":null,
"notification":{
"title":"[MyTitle]",
"body":"[MyBody]"
},
"android":{
"collapse_key":null,
"priority":"HIGH",
"ttl":"0s",
"restricted_package_name":null,
"data":null,
"notification":{
"title":null,
"body":null,
"icon":null,
"color":null,
"sound":"default",
"tag":null,
"click_action":null,
"body_loc_key":null,
"body_loc_args":null,
"title_loc_key":null,
"title_loc_args":null
}
},
"webpush":null,
"apns":{
"headers":null,
"payload":{
"aps":{
"alert":null,
"badge":0,
"sound":"default",
"content-available":0,
"mutable-content":0,
"category":null,
"thread-id":null
}
}
},
"token":"MyValidToken",
"topic":null,
"condition":null
}
As far as i can tell the service is not using the 'staging' environment mentioned in the post below.
FCM service unavailable nack
I am getting hundreds of these UNAVAILABLE answers a day, sometimes for hours on end. Messages are still getting through so i'm not sure i'm getting blacklisted. I don't see anything in their documentation to state if i'm using the wrong URL or hitting some sort of throttling limit.
This was because the FcmSharp service didn't implement the undocumented exponential back-off feature that is required by some Google Apis.
See the GitHub thread for more info.
https://github.com/bytefish/FcmSharp/issues/31

Meteor Google Calendar Push notification "Unauthorized WebHook callback channel"

I want to use google calendar notification.
I have deployed my Meteor application to
https://google-push-notification.meteor.com
I have verified the url in google web master.
Added the same domain to Domain Verification of Google Console.
I have created Meteor rest api of https://google-push-notification.meteor.com/api/articles for get and post method both.
Below is the postman collection of apis. https://www.getpostman.com/collections/106be7c94d35fcbdb0f8
Post https://www.googleapis.com/calendar/v3/calendars/abc#gmail.com/events/watch
Authorization: Bearer ya29.YwJdqjlSv8Tkl5MEJgiVXQPGxE24ZfITuf8gt0C8DO_VHDvB_1mRAgpAx64R6Wpw8I6fiw
Content-Type: application/json
{
"id": "ya29.XwI-RJ54rS3dbRHgak8V_iTuV7uAWJoZfRFnUE76uCIIUbw4eILPsdEME56Jm5_EfDtWWWs",
"type": "web_hook",
"address": "https://google-push-notification.meteor.com/api/items"
}
I am getting the following response
{
"error": {
"errors": [
{
"domain": "global",
"reason": "push.webhookUrlUnauthorized",
"message": "Unauthorized WebHook callback channel: https://google-push-notification.meteor.com/api/articles"
}
],
"code": 401,
"message": "Unauthorized WebHook callback channel: https://google-push-notification.meteor.com/api/articles"
}
}
Why am I getting push.webhookUrlUnauthorized response even when I have verified my site in google and added the same domain in google console.
Can anyone please help us to solve the issue
According to the google forum, make sure you have validate the following items below:
Please make sure to follow the steps to correctly verify that the domain indeed belongs to you here: https://support.google.com/webmasters/answer/35179
It must be a https endpoint and the same endpoint must also be present in the developer console as per instructions here: https://developers.google.com/google-apps/calendar/v3/push#registering
Hope this resolve your issue. Cheers!

Resources