Hi. I'm having problems using AppAuth in a Swift macOS app.
I'm using Carthage as dependency manager and the integration seems to work as expected.
When I try to start the HTTP listener, I observe two different (related) issues. When I run this code:
let successURL = URL(string: "https://openid.github.io/AppAuth-iOS/redirect/")!
self.redirectHTTPHandler = OIDRedirectHTTPHandler(successURL: successURL)
let redirectURI = redirectHTTPHandler?.startHTTPListener(nil) // This line makes the app crash
I get this logged in the console: CFSocketSetAddress bind failure: 1, and then a crash in the last line of the snippet above.
I don't know why the server cannot be started in the first place, it seems to fail here, but I don't know why, and I think the crash after is due to the fact that the function startHTTPListener of OIDRedirectHTTPHandler is imported to Swift like this:
/*! @brief Starts listening on the loopback interface on a random available port, and returns a URL
with the base address. Use the returned redirect URI to build an @c OIDAuthorizationRequest,
and once you initiate the request, set the resulting @c OIDAuthorizationFlowSession to
@c currentAuthorizationFlow so the response can be handled.
@param error The error if an error occurred while starting the local HTTP server.
@return The URL containing the address of the server with the randomly assigned available port.
@discussion Each instance of @c OIDRedirectHTTPHandler can only listen for a single
authorization response. Calling this more than once will result in the previous listener
being cancelled (equivalent of @c cancelHTTPListener being called).
*/
open func startHTTPListener(_ error: NSErrorPointer) -> URL
and it should return URL? instead, right?
Thanks for your help.