OSX Push Notifications for Websites - Safari requestPermission callback never called - macos

Following the instructions as per Apple Documentation to allow a user with Safari to visit a website and get Push Notifications for the Apple Push Notification Service.
I'm using SSL, have a certificate from Apple, and have generated the push package file.
Safari downloads this when running the prompt requestPermission, displays the user permission request prompt, but on the user clicking 'approve', the callback function is never called.
window.safari.pushNotification.requestPermission(url, websitePushID, userInfo, callback);
The callback function is never called.
No exceptions are thrown.
No POST is made to the server for any success or error.
The website is now listed under System Preferences > Notifications.
The website is not listed under Notifications within Safari Preferences.
Further attempts to requestPermission or query permission are denied instantly.
The only way to reset the denied permission is to edits OSXs internal sqllite file and delete a bunch of config files within Safari before I can retry the request.
What could be causing this unusual behaviour?

It's hard to judge without the exact javascript you are using, but the 3 permission types that you see in the apple documentaion are default, granted and denied.
If the permission is granted or denied, then the user has already set whether they want to receive these push notifications. Once a user has denied a push notification then Apple has made the decision that they cannot be asked again (without changing settings.) If they already have been granted permission there is no need to call window.safari.pushNotification.requestPermission
The only time that you would call window.safari.pushNotification.requestPermission is when permission has neither been denied nor granted. Only in this case will you want to call the function and expect for a response to trigger the callback function. If you see a permission request prompt it means the requestionPermission has worked.

Related

Google auth2 asks for permission every time when asking for access to the app

Without changing my code or configuration, now google is asking users to grant permission every time when a user is trying to authenticate to my App. Even though the user already grated access and the scope didn't change.
I don't get any errors and the login works fine is just that now the google dialog asking for permissions appears every time.
To initialise google I use gapi.auth2.init with the "https://www.googleapis.com/auth/plus.profile.emails.read" as scope.
Also to request for access I use auth2.grantOfflineAccess.
I also checked in my Google account for Apps that have access and the application is registered successfully in there.
Anyone else has seen this issue? Or does know if google changed something in the way they handle permissions?
I believe I am seeing similar behavior... that the authentication flow has begun asking the user to grant the app permissions to the scopes every time they sign in. Previously, it would only proceed from sign-in to grant permissions the first time the user signed into the app. I haven't changed the scopes requested nor the underlying code recently... but also hadn't used the app in awhile (months?)
I'm using the oAuth2 server-side authentication and grantOfflineAccess() outlined here .
Given that there are no implementation details posted, i can't tell if the fix I found will apply to your situation.
The correction I found... so that the authentication only asks the user to grant the first time they sign into the app was to explicitly specify the "prompt" attribute when calling getOfflineAccess().
var auth2 = gapi.auth2.getAuthInstance();
auth2.grantOfflineAccess({
prompt : 'select_account'
}
).then(signInCallback);
https://developers.google.com/identity/protocols/OAuth2WebServer#offline
Check Step 1 prompt parameter

HttpError 403 google directory api

I got the super admin privileges for to my Google Account.
I need to get the list of all the chrome devices through an API.
I did enable Google Admin SDK but still facing some issues.
I copied the exact python script from Python Quickstart for checking but still getting error as
"googleapiclient.errors.HttpError: https://www.googleapis.com/admin/directory/v1/users?customer=my_customer&orderBy=email&alt=json&maxResults=10 returned "Insufficient Permission">"
When checked on Admin SDK API dashboard I can see 4xx errors for every call made from my python script.
When you run the sample you need to make sure that this step
The sample will attempt to open a new window or tab in your default browser. If this fails, copy the URL from the console and manually open it in your browser.
If you are not already logged into your Google account, you will be prompted to log in. If you are logged into multiple Google accounts, you will be asked to select one account to use for the authorization.
Is done from the Google account which has access to your admin account. The user you are logged in with now does not have access.
I managed to get Super Admin access of Google account and then grant access to my project for different scopes. The docs/ references are so confusing hence it took a while for me to figure it out. So under the admin console, we have to get into Security >> Advanced Settings >> Manage API Client Access(under Authentication) and then add the client name and the scopes(multiple scopes separated by commas) for which we need access. Client name is the client-id which we can get from the client-secretxxxxx.json file(downloaded while creating the oauth id).
NOTE :- You do NOT need super admin access it is just that I was new and the guy who gave me the initial access wasn't sure what has to be enabled across.
Also couldn't post as a comment due to the limitation of characters.

Temporary entitlements to call AXIsProcessTrustedWithOptions

When I call AXIsProcessTrustedWithOptions in a sandboxed program the dialog to request permission does not open and I get "sandbox deny(1) mach-lookup com.apple.universalaccessAuthWarn" error in the console.
If I add a temporary entitlement com.apple.security.temporary-exception.mach-lookup.global-name for com.apple.universalaccessAuthWarn the error goes away and the dialog appears. This doesn't make any sense however that should I need this entitlement to simply ask the user for their permission and I suspect it will get rejected from the AppStore.
Does anyone know if what I'm doing is correct?

Where exactly Android Wear app Permission request to be placed

I want to request the permissions that I need for my android wear app upfront as per this. So Programmatically where exactly I should put my permission request code. Also is the protocol to ask for Permission the same as the mobile app like this.
All of the permissions are controlled in the Androidmanifest. Here is an example of some permissions being declared in the Androidmanifest:
These permissions are used to get the weather from the device and relay the information to an Android Wear device. Google offers documentation for developers to use to determine what permissions should be used. Declaring permissions should happen in the Androidmanifest in the format provided in the image. In the sample code posted, it is not necessary to include watch permissions, they are only required if the app works with Android Wear.
Way back in the day Google added a feature in Android 4.3 that let the user control what permissions apps could access on a per app basis known as App Ops. This was a great feature that cut down on privacy issues and gave users the piece of mind knowing that random apps installed could not access the device’s location. When Google introduced Android 6.0 Marshmallow, This time when an app needs to use a permission a dialog box pops up on the screen and asks the user if it is OK that the app uses a certain permission. This may get a little annoying, but at least every permission used by an app has to go through the user first.
If your app doesn't already have the permission it needs, the app must call one of the [requestPermissions()](https://developer.android.com/reference/android/support/v4/app/ActivityCompat.html#requestPermissions(android.app.Activity, java.lang.String[], int)) methods to request the appropriate permissions. Your app passes the permissions it wants, and also an integer request code that you specify to identify this permission request. This method functions asynchronously: it returns
right away, and after the user responds to the dialog box, the system calls the app's callback method with the results, passing the same request code that the app passed to requestPermissions().
You should dynamically request the permissions from user on wearable devices just the same way you do on the phone side.

firebase hosting - terminal hangs waiting for authentication

I just created a firebase account using my Gmail account and I want to test deploying a simple JS app to the cloud. I'm using Linux. I type in firebase init and the terminal says, "Waiting for authentication" then the browser opens and for a quick second I see a message "Authenticate Application" but then it disappears and asks me to login to my Google account. I login and it redirects me to my dashboard. In the terminal window it is still waiting for authentication. So the browser never tells the terminal window that I logged in and is stuck.
Any ideas?
I found a different thread with an answer that worked for me (How to login to `firebase-tools` on headless remote server?)
On the terminal use the following command:
$ firebase login --no-localhost
A different authentication link will be generated. On any machine, open a browser and paste the link from the terminal.
The result is an authorization code that you now need to paste into the terminal.
Everything should work well...I hope...
before firebase init you should be logged in (firebase login)
if you hit firebase login
first your cli asks permission to allow firebase
Allow Firebase to collect anonymous CLI usage information?
type yes and hit return
now an url will be generated
copy the url and open in any browser
login (if required)
if you are using first it asks for permission when you hit ok
login successful

Resources