Authorization Plugin View Still Appears After Login on Home Screen for a Few Seconds

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?

Answered by DTS Engineer in 827793022

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"

Accepted Answer

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"

Thank you for your detailed response and suggestions. I’ve explored the workaround you proposed and wanted to share an update:

  • I implemented a second mechanism tied to the loginwindow:done event to close the window after authentication completes. Unfortunately, this didn’t fully resolve the issue. While I can hide or dismiss the plugin window from the second mechanism, I still observe the gray screen appearing for about a second before the desktop environment fully loads.

  • Following your recommendation, I’ve filed a bug report via Feedback Assistant. The ticket number is FB16734033.

Authorization Plugin View Still Appears After Login on Home Screen for a Few Seconds
 
 
Q