Foirebase no server key found - server

My project in FCM has no server key shown in cloud messaging .. only sender ID as shown .. and I am trying to send notification from post man .. so I must have the server key
I tried to get the key from the google-services.json file api_key .. current key but it's not working.
the code sent in postman is :
header:
Authorization key="AIzaSyBENvif3XkufbKkjRRE92ECj7RBA0LlWj0"
body:
"to":"c_OHgeJnQmi_F3i3D7wivZ:APA91bHnvHMI_mR9IWoesWeBOLE1aEXGa-1v-1UVCtt1MriXRo03VcaxxTiBAztnbUOrXCf_AVAqAgyOGBcvK4IsO0cW1o1UNXJQqVpkLKveH0aAPkd7kHvBhUGcGkY--IfBctUvgrR7",
"notification" : {
"body" : "New announcement assigned",
"OrganizationId":"2",
"content_available" : true,
"priority" : "high",
"subtitle":"Elementary School",
"Title":"hello"
},
"data" : {
"priority" : "high",
"sound":"app_sound.wav",
"content_available" : true,
"bodyText" : "New Announcement assigned",
"organization" :"Elementary school"
can any one help please ?

I found the solution ... FCM has two ways to send notification
1 - Firebase Cloud Messaging API (V1)
2 - Cloud Messaging API (Legacy)
The server key is available on the second way which is disabled by default and must be enabled to get the server key and send notification via API using post man

Firebase Generate Server-Key 2023
I ran with this issue so this is what i've done
The server key for testing the Cloud messaging is disabled by default
First navigate to the menu of firebase and click Project Settings -> Cloud messaging tab
enter image description here
You will find Cloud messaging API disabled enter image description here
click on the dots -> manage API in Google enter image description here
Click on enable 4
Return and refresh the page, you should now be able to copy & test with your server key.

Related

Firebase Cloud messaging push notification not showing after flutter web app terminated

I am implementing the firebase cloud messaging to make my push notification service for a project but I am at a block, if I close down the tab which means I close my flutter web application I do not get the notifications that were sent whilst the time my app was closed in my browser.
I have looked through different threads here suggesting i remove the notification key from the message I am sending to FCM.
Please refer to the payload sent:
> {
"to" :[ "xxxxxxxxxx"]
"data" : {
"body" : "Notification Body",
"title": "Notification Title",
"key_1" : "Value for key_1f",
"key_2" : "Value for key_2"
}
}
The problem though still remains when I close the tab running my flutter web app and send a notification, I do not receive it when I open the app in a new tab again.
Essentially I have to provoke the onMessageReceived() function but I guess this would not be in my case. Is it different because the thread(link) are based on mobile apps and not web applications.
`

send notification from the client - Firebase Cloud Messaging - swift programmatically [duplicate]

This question already has answers here:
How to send one to one message using Firebase Messaging
(5 answers)
Closed 1 year ago.
Is it possible to find a push notification from the client using swift?
I searched online and the only examples, documentation I found were strictly related to the use of Firebase Cloud Functions and or using the Firebase Console.
I wanted to know if it's possible to create and send a notification using Firebase Cloud Messaging from the client.
It's actually possible using the firebase rest api, the following endpoint could be used to send a notification:
https://fcm.googleapis.com/fcm/send
The HTTP request must be a POST request with these headers:
Authorization: key=<server_key>
Content-Type: application/json
and the following body:
{
"to" : "<FCM TOKEN>",
"collapse_key" : "type_a",
"priority": 10,
"data" : {
"body" : "Notification",
"title": "Notification title"
}
}
Of course you need to know to the FCM token of the target device that should receive the notification or at least the topic where the device/user is subscribed to. If you want to send notification to a specific topic use the following body:
{
"to" : "/topics/<YOUR_TOPIC>",
"collapse_key" : "type_a",
"priority": 10,
"data" : {
"body" : "Notification",
"title": "Notification title"
}
}

Google Home report state request is working but not showing expected result?

I'm integrating google assistant with my application. The problem is when I send a report state request to assistant while inside a device screen in google home application, I get a 200 OK response with the requestId I'm sending, but the device screen doesn't update with the device state. (It gets updated after I go back and go to device screen again but that is done through query intent)
Sample Request Body
{
"payload" : {
"devices" : {
"states" : {
"12364" : {
"on" : true
}
}
}
},
"requestId" : "A7TNpoXlnG0OQWzpTvJAa4sjolAAt46q",
"agentUserId" : "14556"
}
Sample Response Body
{ "requestId" : "A7TNpoXlnG0OQWzpTvJAa4sjolAAt46q" }
This is their documentation regarding the report state.
I even deployed the report state dashboard locally to monitor the state changes but it doesn't update as well.
Can anyone point me in right direction? Thanks!
The behavior of different Assistant surfaces with respect to Home Graph changes can vary, so it's best not to rely on looking for real-time UI changes in the Google Home app.
The Report State Dashboard noted in the documentation that you linked is a good way to validate the state you publish to Home Graph graphically. We also recently published an AoG ProTips episode on this topic that shows you how to do the same from the command line.
Neither of these methods will update automatically in real-time either, but you can refresh them after publishing a state change to verify the right data is in Home Graph.

How to server side login using facebook and google using meteor?

my meteor app evolve to server side only now. so everything will be server side using rest api.
I need to login using social media on server side only.
this is example of payload :
{
"type" : "facebook",
"token" : "SOME_FB_TOKEN_HERE"
}
Google login :
{
"type" : "google",
"token" : "SOME_GOOGLE_TOKEN_HERE"
}
it will return :
{
"meteor_auth_token": "METEOR_AUTH_TOKEN_FOR_AUTHORIZATION"
}
how to do that in server side?
I think it is possible only on client side. See https://docs.meteor.com/api/accounts.html#Meteor-loginWith
where methods loginWithXXXXXXX work on client side only.
Maybe if you check how this methods work, you can create your self auth on server side.

real time updates for facebook page blues

i am having a heck of a time getting facebook real time updates to work for a page. true, this question may have been asked - more than once - but i have not seen a definite routine given as an answer. mostly just disjointed suggestions. as a disclaimer - allow me to add i have read the documentation all over many times. you will see this when i post my routine. i am getting no updates after all of this.
create a page. named Testerthree, category : brands & products : app page, website : _http://< mydomain >.com, page id :
developers.facebook.com
i create an application : Testerthree
a. settings : Testerthree namespace : tester_three
b. create a platform : website : Site URL : Mobile Site URL : _http://< mydomain >.com
c. add a platform : page tab :
Page Tab Name : Testerthree Secure Page Tab URL : _http://< mydomain >.com
d. app domains : _http://< mydomain >.com
e. app details : i fill out all the info for the top box. category : apps for pages
this is where things get kinda weird. there's a button there under "App Page" to create a new page for the app....sometimes this works automatically and sometimes it doesnt. basically i do know now how to connect a page to this field. however erratic the process is. basically, listed here for "App Page" - is a page i created with the same name : Testerthree
app id : < app id > app secret : < app secret >
so at this point what i would have is a page : Testerthree
and an app : Testerthree
I have the page listed in the App Details page as the role of App Page
then i begin trying to get the requests to query and configure facebook. this process appears to work, and create a subscription, but nothing is ever sent from my page to my server through the app. if i subscribe to USER fields through the app, they update. if i subscribe to the PAGE fields, i get no update. either way, here goes :
get access token :
_https://graph.facebook.com/oauth/access_token?client_id=< app id >&client_secret=< app secret >&grant_type=client_credentials
not sure if this is needed, but it was a piece of the puzzle i never let go :
_https://graph.facebook.com/oauth/authorize?client_id=< app id >&redirect_uri=_http://< mydomain >.com/fb/return.php&scope=manage_pages,offline_access,read_stream
creating the subscription :
_https://graph.facebook.com/< app id >/subscriptions?access_token=&object=page&fields=feed,description,general_info&verify_token=&method=post&callback_url=_http://< mydomain >.com/fb/facebook-subscribe.php
now i DO have the entry point on my server at _http://< mydomain >.com/fb/facebook-subscribe.php
the code in it looks liike the code specified here (facebook-subscribe.php) :
http://mwc.byteshaman.us/fb/fbsubscribe-code.php
which should take any post data and output to a file. honestly prior to all this i put a small random fopen, to create an output txt file, if this .php is ever viewed or pinged. when i create the subscription, the txt is made. when i test my subscription, no txt is made.
either way
i check the subscription with this :
_https://graph.facebook.com/< app id >/subscriptions?access_token=&method=get
and it DOES show a subscription like this :
{
"data": [
{
"object": "page",
"callback_url": "_http://mydomain.com/fb/facebook-subscribe.php",
"fields": [
"description",
"feed",
"general_info"
],
"active": true
}
]
then i connect the page with the app with this :
_https://www.facebook.com/dialog/pagetab?app_id=< app id >&redirect_uri=http://< mydomain >.com/fb/return.php
this is an insane amount of steps to subscribe to a feed. cheers to facebook. someone please aim me in the direction to the part in their documentation where they give one complete cohesive example of any of this....
well, it appears as if i have a subscription setup after all this. the page is listed in my app details. the subscription is showing subscribed.
yet when i update my page feed, or change some of the description data (which is supposed to be subscribed to) I get nothing.
anyone please help?i've done all the homework possible, and this post is my last attempt after 3 days, before gaining the absolute belief that this routine is impossible and there's actually no such thing as realtime updates for facebook pages, like the Easter bunny, or Santa claus.
is it possible? does anyone know the routine? can anyone identify where i messed up?
thank you.
i have the answer : cron jobs. the facebook real time api is erratic when it comes to pages. the solution was to never use the facebook realtime update api and just use a cron job instead. thanks for playing. there was no winner or loser.