Can't sent REST message to Google FCM from ServiceNow - android

I'm trying to send REST messages from ServiceNow tool to FCM, but getting "Invalid username/password combo" message. Firstly wanted to test this in POSTMAN, but still getting [JSON_PARSING_ERROR: Unexpected token END OF FILE at position 0.].
The full error message I get from ServiceNow is as following:
DEBUG: origin=push auth="MTdhMzhhNTJmZGMxNGQwMGJjNjY4Mjc5YTEzNDBiMWM6U1d0Y1RjOUE1T2paQWd2NTdmVUg=" Adding authorization header
SEVERE * ERROR * app="[APP_NAME]" request=b819e5c92ea4b2006ead1a337b41f078 origin=push elapsed=41 status=401 rest error message: Method failed: (/fcm/send) with code: 401 - Invalid username/password combo
As we're not using any login/password for REST message, I assume there must be an issue with Server Key. I've read many threads here about 401 error, but still could not fix an issue. I'm using the long one (not legacy) server key from FCM console cloud messaging tab.
Kindly help, if someone has any ideas

Related

Huawei In App Purchase, implemented everything correctly but still getting the error : authorization format invalid

I am trying to implement Huawei in App Purchase kit to my application.
The request I am sending to the server is here:
request {"purchaseToken":"0000017343ec91821b076fd75f71103a5a85595d2dfd245d708fd6058e676f857792b83622c7fd51x434e.1.100059717","productId":"1007"}
I am following this guide here : https://developer.huawei.com/consumer/en/codelab/HMSInAppPurchase/index.html#0
I am following the same steps but
I am getting an error message from server which says :
result: {"responseCode":"6","subErrCode":"211","responseMessage":"6-211-authorization format invalid"}
Which part I might be doing wrong?
In the error you are getting, it says "authorization format invalid". This means your ignature verification data format is invalid. The possible errors might be :
The token in the request header is not encrypted in Base64 mode.
The character string APPAT is not appended before the access token for authorization. The correct access token is similar to APPAT:thisIsAppAtVaule.
for more information, please check : https://developer.huawei.com/consumer/en/doc/development/HMS-Guides/iap-FAQ
You are facing issue in server side. Kindly go through the given link to know more about In App Purchase server side and client side.
In-App Purchase Article Develioper Forum:
Client side : https://forums.developer.huawei.com/forumPortal/en/topicview?tid=0201255229704010231&fid=0101187876626530001
Server side : https://forums.developer.huawei.com/forumPortal/en/topicview?tid=0201273064244120101&fid=0101187876626530001
In-App Purchase Github Link :
Client side: https://github.com/DTSE-India-Community/HMS-In-App-Purchase-Kit
Server side:
https://github.com/DTSE-India-Community/Huawei-In-App-Purchase-And-Push-Kit-Server_Side-Implementation

FCM: Invalid registration token. Check the token format

I’m implementing Firebase Cloud Messaging (FCM) and am experiencing a problem that I’m unable to solve. I have implemented FirebaseMessagingService and FirebaseInstanceIdService according to the guide(s). When I go to Firebase Console for my app, and use the Notification function, I can successfully send a message to ALL my app instances (using the package name).
Now, in the code I have fetched the Firebase Instance Id (token) by use of the following code:
String token = FirebaseInstanceId.getInstance().getToken();
SendFirebaseTokenToServer(token);
(note that currently I’m using HTTP protocol, as my server does not yet have a cert). Anyway using the token I get from the call above, I go back to the Firebase Console and try to send a message to one (1) installed instance of my app. I grab the token from our server DB where it is stored as "varchar(max)". When I do that I get the following error message:
Invalid registration token. Check the token format.
I have googled that and found only one hit (having to do with Firebase and iOS):
http://stackoverflow.com/questions/41343520/ios-invalid-registration-token-check-the-token-format
That issue indicates that a cert was required (I think I’m reading it correctly). I’m not sure what I’m doing wrong. I need to get this to work using the Firebase Console first, then my server guy can start on his end knowing that it should work.
Turns out i was programatically encoding all POST or PUT parameters prior to sending to our server. the FCM token had a semicolon in it, which got encoded to a "%3A", seemingly causing the problem.
do NOT encode the FCM token.

Firebase cloud messaging authorizion error

i am trying to send FCM push notification to my android app
on from postman i have on my developer console two api keys when i try to use the first one i get this response from FCM :
Unauthorized
Error 401
and when i try the second one i get this response from FCM :
Error=MissingRegistration
and i have this data in the body :
{ "data":{
"score":"5x1",
"time":"15:10"
}
,
"to":"*******"
}
the token is working fine and i have test it in the firebase console
what the problem could be and what is the solution
Error 401 Unauthorized comes beacuse of wrong server key.
To solve this error:
Go to your project settings in firebase console.
Click on Cloud Messaging and copy Server Key mentioned in that page.
Let me know, if more help is required.

google cloud messaging send server error

I tried to play around with the gcm demo but I had some troubles to figure out why my server can't send message. I used the project number as sender ID for the android app and the server generated API key for the server side. I see that the app has registered to the server but once I send one message, the server crashes and shows :
message HTTP Status Code: 401
com.google.android.gcm.server.InvalidRequestException: HTTP Status Code: 401
com.google.android.gcm.server.Sender.sendNoRetry(Sender.java:177)
com.google.android.gcm.server.Sender.send(Sender.java:121)
com.google.android.gcm.demo.server.SendAllMessagesServlet.doPost(SendAllMessagesServlet.java:82)
javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
Any ideas how to fix that?

Getting 401 response from C2DM

I am getting exception from google saying:
java.io.IOException: Received authentication challenge is null
I read that this is reproducing 401 error. So this
Indicates that the ClientLogin AUTH_TOKEN used to validate the sender is invalid.
But i have everything registreted and logined with ClientLogin successfully.
So what wrong could be?
Also do i need to reigstrate my app here ?
Sing up for C2DM
Because i haven't
Thanks
Have u register your app on the given link . Also you should get mail from C2DM on mail id which you have mention in Contact email address.

Categories

Resources