The request was missing an Authentification Key FCM Token - ruby-on-rails

I am trying to hit using postman firebase url but it is giving me error.
I have setup all the things but it still it is giving me error
Here is the error which I am getting on postman
<HTML>
<HEAD>
<TITLE>The request was missing an Authentification Key (FCM Token). Please, refer to section "Authentification" of the FCM documentation, at https://firebase.google.com/docs/cloud-messaging/server.</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>The request was missing an Authentification Key (FCM Token). Please, refer to section "Authentification" of the FCM documentation, at https://firebase.google.com/docs/cloud-messaging/server.</H1>
<H2>Error 401</H2>
</BODY>
</HTML>
These things I am adding <br/>
url = 'https://fcm.googleapis.com/fcm/send'<br/>
method = POST<br/>
Headers <br/>
Authorization = 'FIREBASE_SERVER_API_KEY'<br/>
Content-Type = application/json<br/>
Body =
"{"registration_ids":["ids"],"priority":"high\",\"data\":{\"notification_id\":76,\"title\":\"dvxcv\",\"description\":\"xcvxv\",\"image\":\"/uploads/image/image/37513/Screenshot_from_2016-10-17_10_43_59.png\"}}"

All you need to do first in Header
Authorization: key='FIREBASE_SERVER_API_KEY'
And you are having problems with json parsing you have to remove '/'
{"registration_ids":["ids"],"priority":"high","data":{"notification_id":76,"title":"dvxcv","description":"xcvxv","image":"/uploads/image/image/37513/Screenshot_from_2016-10-17_10_43_59.png"}}
Edit
For any confusion follow my tutorial
how to integrate firebase with ruby on rails

Under Headers, Authorization: key=AAAA.....
HAVE TO ADD "key=" in front of the Firebase Server key token!!!

Related

How to add header (for jenkins crumb) to github webook?

We are trying to setup a webhook so that we can trigger jobs on our publicly accessible Jenkins server using https://github.com/blar/blar/settings/hooks
The form offers us a "Payload URL" field, but no field to provide additional headers. This means we cannot provide a Jenkins crumb so that the request can authenticate properly. Without the header with the crumb we get the following response from the webhook delivery:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 403 No valid crumb was included in the request</title>
</head>
<body><h2>HTTP ERROR 403</h2>
<p>Problem accessing /ghprbhook. Reason:
<pre> No valid crumb was included in the request</pre></p><hr>Powered by Jetty:// 9.4.z-SNAPSHOT<hr/>
</body>
</html>
How can we tell github the headers we want to use???
Please refer - https://stackoverflow.com/a/59861256/1726235
Try to authenticate with API key instead of Password
So github doesn't currently support headers, but it turned out that in my case this was a total red herring. I simply missed a slash on my URL https://stackoverflow.com/a/51545557/1586965

Accessing Twitter Sample Streaming Endpoint?

I'm trying to access the following GET https://stream.twitter.com/1.1/statuses/sample.json end-point in these docs.
From POSTMAN, I set an Authorization header with a value of Basic X where X is equal to the base64 encoding of $ConsumerKey:$ConsumerSecret.
When issuing the GET call from POSTMAN, I see the following prompt:
Confused as to why my OAuth credentials aren't accepted, I entered my Twitter user and password.
But, the server replies with:
<html>\n
<head>\n
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>\n
<title>Error 401 Unauthorized</title>
</head>
<body>
<h2>HTTP ERROR: 401</h2>
<p>Problem accessing '/1.1/statuses/sample.json'. Reason:
<pre> Unauthorized</pre>
</body>
</html>
In addition, I typed in my Consumer Key and Secret for the user and password prompt, but that failed too.
So, how can I hit this endpoint from POSTMAN? I'm not entirely sure if it's a stream. If it is, would I still be able to hit it via POSTMAN?

Postman - Push GCM to iOS with Postman

I am trying to test GCM to my app with Postman. But It is not authorized.
In the header i put for
Key : The Server key (auto created by Google Service)
Value : application/json
And in Body - Raw :
{ "data": {
"score": "5x1",
"time": "15:10"
},
"to" : "lKVLmzMmvoU:APA91bFrbpmT4IAxS-rN9sr_y8-YDgrySaC7bMx3Pm_Qd-uEb7dfMnMaJRvNfPTj9c1YdhBJp6ClbsIvMKogmet9V0-HV_sgkBNUx59Rq25Ccbys0NWuuh_Mpd7ryK-98pxRV7B2WW63"
}
The value for "to" is the token I got from the GCM Registration.
But I have this response :
<HTML>
<HEAD>
<TITLE>Unauthorized</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Unauthorized</H1>
<H2>Error 401</H2>
</BODY>
</HTML>
Thank you !
Each line within Postman is a key-value pair, your values should look something like this:
Postman have a great guide here with lots more helpful tips.

Why my PUT request using the google spreadsheet isn’t working?

I’ve been through every step mentioned here https://developers.google.com/google-apps/spreadsheets/#changing_contents_of_a_cell using the protocol and submitting the requests, right now, with POSTMAN before doing an actual script.
On the step of editing a cell via PUT i get a 403 Forbidden with the error "If-Match or If-None-Match header or entry etag attribute required”.
Right now my request URL is:
PUT https://spreadsheets.google.com/feeds/cells/MY_SPREADSHEET_ID/od6/private/full/R1C1?v=3.0
Headers:
Authorization Bearer {my access token}
Content-Type application/atom+xml
Raw
<entry xmlns="http://www.w3.org/2005/Atom"
xmlns:gs="http://schemas.google.com/spreadsheets/2006">
<id>https://spreadsheets.google.com/feeds/cells/MY_SPREADSHEET_ID/od6/private/full/R1C1</id>
<link rel="edit" type="application/atom+xml"
href="https://spreadsheets.google.com/feeds/cells/MY_SPREADSHIT_ID/od6/private/full/R1C1"/>
<gs:cell row="1" col="1" inputValue="hello"/>
</entry>
Any ideas please?
ps.: if I remove the ?v=3.0 there will be another error demanding the version
You should add the header If-Match:*
It should work out of the box that way, however, more on subject can be found on http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html

Linkedin REST API Auth and JSAPI call, Rails/Omniauth

I lost my temper few days ago because of this simple problem. Can you help me on this?
I'm suppose, since it's written in the Linkedin JS API documentation here, to be able to logion with REST and launch calls with JSAPI :
https://developer.linkedin.com/documents/inauth-inevent-and-inui
Authorization Tokens
While the easiest method of authenticating a user for the JSAPI is to
use one of the login buttons, some sites have implemented the OAuth
1.0a flow used by the REST API. Whichever type of authentication you use for the user, the JSAPI will recognize that the member has already
logged in, as long as the key and hostname are the same. This happens
automatically, requiring no additional code by the developer.
But this is NOT working, I have this weird console error :
Cannot call method 'Profile' of undefined
when I call this right after REST auth:
IN.API.Profile("me").fields(["id", "..."]).result(linkedin_connect_save);
Any ideas?
That console error doesn't have anything to do with authentication - I'm guessing you're loading another javascript framework which is interfering with the LinkedIn framework and the IN object isn't getting properly loaded.
The following page works with a key that I've previously authenticated using REST in the same browser here: http://developer.linkedinlabs.com/tutorials/testing.html
<html>
<head>
<title>Connections App Example</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body class="yui3-skin-sam yui-skin-sam">
<script type="text/javascript" src="http://platform.linkedin.com/in.js">
api_key: MY_API_KEY
onLoad: loadData
authorize: true
</script>
<script type="text/javascript">
function loadData() {
IN.API.PeopleSearch()
.fields("firstName", "lastName", "distance", "publicProfileUrl","pictureUrl")
.params({"keywords": "princess", "count": 10, "sort": "distance"})
.result(function(result) {
alert(JSON.stringify(result));
});
}
</script>
</body>
</html>
your code might call before js load..
include js before ur code..

Resources