I’ve implemented the ASWebAuthenticationSession
forkflow for my macOS Safari extension, as requested by App Store Connect review team. However this opens a window which takes whole screen. How may I specify the window size before it is shown to user?
Here is the code I do to make it work:
// This works in App Extension, so we do not have any root NSWindow
let loginSession = ASWebAuthenticationSession(url: authURL, callbackURLScheme: scheme) { callbackURL, error in ... }
let window = NSWindow()
let presentationContextProvider = MyPresentationContextProvider(view: window)
loginSession.presentationContextProvider = presentationContextProvider
loginSession.prefersEphemeralWebBrowserSession = true
loginSession.start()
However this opens a window which takes whole screen. This looks terrible and I do want to make it smaller, yet nothing is working for me, neither setting a rect
in initializer, changing it after creation, nor anything I tried.
The only option, that works for me is running window.resizeTo(600, 400)
in opened Safari view JS console.
Help me please to find a good solution to this problem.
Filipp Smorygo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.