Safari Push notification is not working - safari

I have been trying Safari push notification. I followed the Apple doc.
Downloaded Apple intermediate Certificate AppleWWDRCA.cer. Exported my website provisioning profile as p12. To create the push Package used ruby package push_package
It created a package zip and it contains all the details that we needed - icon.iconset, manifest.json, signature and website.json.
When I request permission it successfully retrieves all data and gives me token.
But the real problem is when I try to send notification from a PHP script or APN tester its not receiving in the safari. The v1/logs getting called instead with some circular Json object.
Have no idea what to do next. can anyone please help ??
And one more thing I found is, in the logs SafariNotificationAgent (unknown version)

The error was in payload that I used.
It should be like:
{
"aps":{
"alert":{
"title":"Hi there",
"body":"How are you",
"action":"viewed"
},
"url-args":[""]
}
}

Related

Anyone know how to fix the new OAuth2 error when trying to authenticate a PyDrive application?

I don't think this issue is specific to PyDrive, but rather Google OAuth. However, some of the solutions I've seen on stackoverflow don't seem to be transferable over to my PyDrive application, which is just a python script to upload files programmatically to a shared drive. It worked fine 2 months ago but I tried to rerun it today and it's not working. Here is the error I'm getting:
Authorisation Error
Error 400: invalid_request
You can't sign in to this app because it doesn't comply with Google's OAuth 2.0 policy for keeping apps secure.
You can let the app developer know that this app doesn't comply with one or more Google validation rules.
Request Details
The content in this section has been provided by the app developer. This content has not been reviewed or verified by Google.
If you’re the app developer, make sure that these request details comply with Google policies.
redirect_uri: urn:ietf:wg:oauth:2.0:oob
I am using a web application OAuth 2.0 Client ID creds on GCP. All secrets are stored in a local client_secrets.json file.
I run my script, it sends a message to the console that says
Go to the following link in your browser:
https://accounts.google.com/o/oauth2/auth?client_id=blahblahblah.apps.googleusercontent.com&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&access_type=offline&response_type=code
Enter verification code:
How it used to work: After I click the link above, it returns a code I paste into the console and then its authenticated. FYI: I plan on running this 24/7 on a remote server.
Now: I click the link above and get the error I posted above. I've tried to change the redirect uri to 127.0.0.1 and it does allow me to auth, then I get a code in my URL, but once I copy that and paste it into the console, I get more errors.
Anyone know the solution for this?

Push notification support in Twilio IOS sdk

I'm trying to get push notifications on an app that's using Twilio IP Messaging. After following the instructions on twilio guides.
The AppDelegate functions to register for remote notifications is working well - the iOS devices successfully provides the device token to the Twilio Client. However, the TwilioIPMessagingClient gives no indication of success or failure while registering the token.I have used delegates also for that Moreover, I don't get any sign of push notifications when messages get sent.
I have checked logs also where I can see the correct logs:
TNNotificationClient | Starting registration..., id: <....>
TNRegTransport | Creating registration: apn - <....>
TNRegTransport | Registration is created, location: https://ers.us1.twilio.com/v1/registrations/<...>
Where exactly I'm missing? One hint I got to know after much research that in server PHP app, I need to enable push on IPMesaging services client becuase its disabled by default. If yes, where exactly or in which .php file I have to enable it?
Reference:
https://www.twilio.com/docs/api/ip-messaging/guides/push-notification-configuration
Someone else recently solved this problem realizing that they had not set the New Message notification type to be explicitly enabled as follows from the PHP example:
// Update the service webhooks
$service = $client->services->get("YOUR_IP_MESSAGING_SERVICE_SID");
$response = $service->update(array(
"Notifications.NewMessage.Enabled" => "true",
"Notifications.NewMessage.Template" => "A New message in ${CHANNEL} from ${USER}: ${MESSAGE}",
));
?>
Would this solve it for you?

Unable to subscribe to Pushpad Safari notifications

I'm using the Pushpad.xyz library and got my Chrome notifications to work. On Firefox, I call pushpad('unsupported', callbackFunction) and the callbackFunction successfully executes (another bug that I am figuring out separately since Firefox should be supported). However, I am unable to get Safari notifications to work. I entered my Apple developer's certificates as requested in https://pushpad.xyz/docs/pushpad_pro_requirements.
pushpad('init', projectID);
pushpad('uid', signature);
pushpad('subscribe', function(isSubscribed) { alert(isSubscribed); });
pushpad('unsupported', function() { alert('Unsupported browser'); });
On Safari, I don't get the callback to unsupported and the docs say that Safari is supported. Why does it say that the user (me) has blocked notifications for this website? The callback to "status" always returns false. Is there a way to verify that I set up my Apple certificate correctly? Thanks!
The problem with Safari is definitely related to the download of the push package and its signature.
When pushpad('subscribe') is invoked Safari tries to download a "push package" from Pushpad servers and verifies its integrity and signature. If an error occurs (e.g. the signature verification fails) then the user is not even asked for permission and permission is not granted (its value remains default).
So you see that strange message that says that the user has not granted permission. Actually in your case it's not the user who is blocking the notifications: it's Safari who refuses to subscribe to push notifications because the push package is invalid.
Please try to generate again and fix the APNS private key and APNS certificate in your sender's settings on Pushpad. This should solve the issue.
Make sure to follow exactly the steps described here for APNS:
https://pushpad.xyz/docs/pushpad_pro_requirements
If you are testing your website locally make sure to follow the instructions as described in the "Working Locally" section:
pass the hostname option to init
make sure that the address is exactly http://localhost (if you use for example http://127.0.0.1 Safari won't work locally)

API connect published api in developer portal can't work

https://new-console.ng.bluemix.net/docs/services/apiconnect/apic_tutorial.html#apic_tutorial_01
Follow previous link to do create loopback project named ibmsvt and do test locally, we can post and get.
then publish this api as running api app on bluemix and we will get api target url and tls file.
type url and tls in api designer invoke, and publish api product again.
check api connect service and we can find that published api product has been published, configure developer portal, and invite developers
login developer portal and register one app
subscribe app to api product and run post command.
We will see that we only get can't post error information...
Please see attachment info for error info and api file.
From the screen capture provided, it looks like you're displaying the logs for the loopback application deployed on bluemix. It also looks like the POST request from APIConnect hit the Bluemix application as well. However, I'm unable to see the exact message of the error. What error did you get when you execute the POST from APIConnect? I suspect the POST did not include the $(request.path), what did you change the invoke url to be ? Can provide the x-ibm-configuration section in your yaml file? It will be located in your /definitions.
Thanks and best regards,
I am just have the exact problem, and struggled for days on redoing the tutorial several times, but still met with the same problem until found the upper reply, and gave me a hint.
In the tutorial, it says like the following:
Update the following fields with the values you copied previously:
Invoke URL: Insert the API target URL. You must specify the secure protocol HTTPS. For example:
apiconnect-ca3283b0-525c-488d-993b-3ab72fca78d0.youremail-dev.apic.mybluemix.net
TLS Profile: Insert the API invoke tls-profile.
For example:
client:Loopback-client
The origininal URL is $(runtime-url)$(request.path)$(request.search).
And the correct URL after updating is like following:
https://apiconnect-ca3283b0-525c-488d-993b-3ab72fca78d0.youremail-dev.apic.mybluemix.net$(request.path)
no slash before $(request.path), and $(request.search) should be deleted.
I also checked a tutorial video, it also do like this, but the screen for this step is passed away very quickly, you will not pay attention to this detail normally.
https://www.youtube.com/watch?v=Qku71JLv8vA&list=PLFa8jnU0KqE2eW5E449ziaurv8obSbcou&index=3&cm_mc_uid=24774488665514672571374&cm_mc_sid_50200000=1468400063

YouTube API v3 sample project raising GTLJSONRPCErrorDomain -32602 bad request error

I have just downloaded the Google API objective C client. I opened the YouTube example project in Xcode on my Mac. It builds and runs without errors.
I registered a project with Google APIs, and created a Client ID for installed applications, choosing iOS and entering the sample code's Bundle ID, com.example.YouTubeSample. I left the App Store ID blank and deep linking disabled.
I entered the resulting Client ID and Client secrets into the sample app. I signed myself into Google through the app's window too, and it tells me I am signed in.
Independently I went to YouTube and uploaded a 1Mb .mov file, which uploads fine (although it tells me there may be an audio/video sync issue).
I then uploaded the same file through the sample app. When it finished, it gave me the error:
Error Domain=com.google.GTLJSONRPCErrorDomain Code=-32602
"The operation couldn’t be completed. (Bad Request)"
UserInfo=0x.... {error=Bad Request, NSLocalizedFailureReason=(Bad Request),
GTLStructuredError=GTLErrorObject 0x...:
{message:"Bad Request" data:[1] code:-32602}}
(Since the sample app is for Mac OS, not iOS, I also tried creating a second Client ID in Google APIs, for an installed application of type "other". I entered this new ID and secret into the sample app, and when I uploaded the .mov file I got the same error.)
Over in the API console, I see an error report showing some new Error code 400s.
What have I done wrong?
thanks!
The YouTube API packs a "structured error" object inside of the NSError object that it returns. The structured error is a GTLErrorObject that can be inspected to find the reason for the error:
uploadTicket = [service executeQuery:query
completionHandler:^(GTLServiceTicket* ticket, id object, NSError* error) {
if (error) {
GTLErrorObject* const errorObject = error.userInfo[kGTLStructuredErrorKey];
NSLog(#"error from YouTube API: %#", errorObject.data);
}
...
}];
Sample output (formatted for clarity):
error from YouTube API: (
GTLErrorObjectData 0x7fb0c4cc9f10: {
message:"Bad Request"
locationType?:"other"
reason:"invalidCategoryId"
domain:"youtube.video"
location:"body.snippet.categoryId"}
)
I just quit and restarted Xcode and the sample project, and it worked (using the iOS client ID, I haven't tried the other one).
Happy days!