Implementing OAuth2 for MacOS app

Description
Hi,

I’m trying to implement OAuth2 for a MacOS application. I have Universal links working with an HTTPS redirect. I’ve attempted to use WKWebView, but the OAuth response isn’t redirected to my application. And ASWebAuthenticationSession causes my app to crash when Chrome is my default browser, and doesn’t redirect the OAuth response to my app when either Safari or Firefox are set as defaujlts.

What is the best/recommended way to implement OAuth2 for a MacOS application?

Environment details:
OS: Ventura 13.0.1
IDE: XCode 14.1

Answered here: