I am developing a custom authorization plugin for macOS, and I’ve encountered an issue where the auth plugin view remains visible on the home screen for a few seconds after login.
Issue Details:
- After entering valid credentials, I call setResult(.allow) in my plugin to proceed with login.
- The authentication succeeds, and macOS starts transitioning to the home screen.
- However, for a few seconds after login, the authorization plugin view is still visible on the home screen before it disappears.
- I have observed this issue even when using Apple's sample authorization plugin.
Observation:
-
This issue occurs without an external monitor (on a single built-in display).
-
If I manually close the plugin window inside Destroy(AuthPlugin.mechanism), then the auth plugin views do not appear on the home screen, which seems to fix the issue.
-
However, when I do this, a gray screen appears for about a second before the desktop environment fully loads.
-
I suspect that the gray screen appears due to the time macOS takes to fully load the home screen environment after login.
Questions:
-
Why does the authorization plugin view persist on the home screen for a few seconds after login?
-
Is manually closing the plugin window in Destroy(AuthPlugin.mechanism) the correct way to prevent this, or is there a better approach?
-
Is my assumption that the gray screen appears due to the home screen not being fully loaded correct?
-
If the gray screen is caused by home screen loading, is there a system notification or event I can listen to in order to know when the home screen has fully loaded?
I’ve seen this before — not sure it was with one of your DTS cases or someone else — but I’ve never really found a good solution to it. In my experience it was very intermittent. I’d see it, and then it’d go away as soon as I started debugging it. OTOH, other folks seem to see it more consistently.
I’m pretty sure the developer I was helping filed a bug about it, but I don’t have that bug number handy. Regardless of what else you do here, I recommend you file your own bug about it. Please post your bug number, just for the record.
As to workarounds, I’ve never found one I’m super happy with. You wrote:
If I manually close the plugin window inside [destroy mechanism]
which isn’t terrible, but I still have qualms because:
-
You’re manipulating a window you don’t ‘own’.
-
The timing of the destroy mechanism call is not really guaranteed.
Regarding the second, one option would be to add a second mechanism after loginwindow:done, and hide the window from there. By the time your second mechanism runs, authorisation is guaranteed to run to completion.
Of course, the timing of that might make the grey screen issue worse )-:
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"