Getting constant error "publish timed out" on PubNub - android

I've lunched the PubNub sample Android app and it works fine. Yet with my own pub/sub/secret keys, it doesn't.
While with Javascript in Chrome it works fine using my own keys. On Android i'm getting error "publish timed out" constantly.
Is it a known issue? How do I make it work?

Publish Timed Out Error on PubNub Network
This is an unhelpful error which is returned from the error callback within the PubNub Android SDK via Publish. The error reporting service is being upgraded currently and will provide better feedback for debugging. Currently the known errors which will occur on publish are the following:
Common Error Reasons
Invalid JSON
Message Too Large
Invalid Publish Key or Subscribe Key
Incorrect Origin
Note that because the error reporting service will always return "publish timed out", the actual error may be any of the above.
Valid JSON may be in the form of a "String", 123 (number), [1,2,3] (array) or an { 'object' : 'data } (object).
Messages can be up to 32K in size! We charge based on your average usage not your peaks. Also, make sure to double check your API Keys are in the correct order
PubNub is on Mashape! Visit our API Playground - https://www.mashape.com/pubnub/pubnub-network/ - and learn about some of the REST Endpoints available on the PubNub Global Real-time Network.

Related

Can't create Twilio ChatClient on android

I'm trying to build chat application on Android and I've stuck on a very first step. I can't create ChatClient. According to documentation I should call some method like this:
ChatClient.create(context.getApplicationContext(), token, props, myCallback);
Unfortunately I'm receiving error: "Invalid access token grants", you can check this link for error details.
I've verified what's inside my jwt access token and it seems that everything is OK with grants. I've used https://jwt.io/ debugger to test it and could see the following payload(I've dashed my credentials to show only structure):
{ "iss": "SK####################",
"exp": 1516198358,
"jti": "SK#####################",
"sub": "######################",
"grants": {
"identity": "test.user#mail.com",
"chat": {
"service_sid": "###################",
"endpoint_id": "###################"
}
}
}
I've checked all the values and they seem to be OK, I've also tried to copy this token and pass it to my web(JS) project and was able to sign in without any issues which proves that token itself should be OK.
Any help appreciated, thanks
So the solution was to use correct region setting, because tokens in one region are incompatible with services from another.
Error messages on the service side are being refined to better reflect this case.
please do not use "endpoint_id" in the grants, it has been deprecated and may be throwing off some service validation logic.
If you continue getting this error please contact support.twilio.com and provide adb logs and the token itself (do not paste it here publicly). Also see https://github.com/twilio/twilio-chat-demo-android/blob/master/REPORT_BUGS.md

Can't sent REST message to Google FCM from ServiceNow

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

Google subscriptions validation returns error code 400 Invalid

Our app have a subscription option with various tiers.
We are validating the subscription tokens via the Google Purchases.subscriptions.get method :
GET https://www.googleapis.com/androidpublisher/v2/applications/packageName/purchases/subscriptions/subscriptionId/tokens/token
When validating some subscription tokens, we keep getting the following error :
{"error"=>{"errors"=>[{"domain"=>"global", "reason"=>"invalid", "message"=>"Invalid Value"}], "code"=>400, "message"=>"Invalid Value"}, "status"=>400}
While many of the subscriptions are okay, we are still experiencing a high volume of such "Invalid Value" validation responses.
At first we suspected it might be due to usage of apps like Lucky Patcher as mentioned here : enter link description here but it seems to cumbersome to be so common.
Please advice!

Reliability of Facebook Graph error messages

Is there a reliable way of getting access token errors from the facebook platform?
Our iOS/Android App needs to save the users Facebook session. This is fine except that authentication errors we get from Facebook seem to be inconsistent.
Essentially, if we get an error from facebook, we want to know if this requires the user to reauthenticate or if it's due to an intermittent error (i.e. they are being rate limited for some reason).
Most facebook graph errors seem to include an error code in the body of the error message text.
Some do not.
e.g
{"error":{"message":"Error validating access token: The session is invalid because the user logged out.","type":"OAuthException"}}
Does not contain an error code, so the only way to check against this error is to do a string comparison on "message". That seems a remarkably unreliable way of checking for errors.
It seems ~almost~ possible to check to see if the "type" variable in the json string indicates an "OAuthException", except that if the user is rate limited, then that will throw an OAuthException as well but it doesn't require the user to log back in, it only requires them to wait a little while and stop posting so much.
I have seen the How-To listed here: https://developers.facebook.com/blog/post/500 but that will still have the problem that my games will require users to log back into facebook if they happen to be over-enthusiastic about posting to their wall.
So, is there a reliable way of getting errors from the facebook platform?
Right now the best solution I can find is to parse the message string for error codes, and if I don't find any then reparse the string looking for specific messages (such as "Error validating access token") and then finally if I can't determine what the error is, just panic and log the user out.
Unfortunately I haven't found a great way of handling this. The best solution I've found so far is to look to see if the error is an OAuthException, compare the error message against a white list of "acceptable failures" that do not require reauthentication, but if the error does not match any error on this white list, I assume that the user has to reauthenticate with Facebook.
For reference, the only error I've found that can be whitelisted is the "user is rate limited" error. To detect this, I check to see if the error message contains the substring "(#341)", which is the error code of this error (not that this error is one of the few errors that contains an error code in the error message body).

Android oAuth getting 'Received authentication challenge is null'

I am trying to connect to a site using the oAuth protocol, and I am getting the exception 'Received authentication challenge is null' on some devices when I attempt to make a https post. Now this was previously working in the emulator, but I now see the error there as well. I did a web search, and it seems like I would get this exception when I receive an 401 error from the site. Others said this was due to a malformed authentication header, but I am not setting a authentication header at all for this call.
This exact same code works on a number of devices, and used to work in the emulator (I cannot figure out what has changed). The person who runs the site has checked his logs, and does not see an error on his side at all. Does anyone have any idea what might be going on here?
Thanks.
I have found the problem. It turns out that if the time stamp on your oAuth call is incorrect, the server returns a 401 status error which on Android devices causes the "Received authentication challenge is null" exception to be thrown. All of the devices that were having this problem had incorrect times, and fixing the times fixed the problem.

Categories

Resources