Using ASWebAuthenticationSession gives error

So, in iOS14 beta 3 I get the error com.apple.AuthenticationServices.WebAuthenticationSession error 2. when ever I arttempt ASWebAuthenticationSession.

Replies

Turns out you need to add ASWebAuthenticationPresentationContextProviding.


if #available(iOS 13.0, *) {

self.webAuthSession?.presentationContextProvider = self

}


Then have your class conform to ASWebAuthenticationPresentationContextProviding by doing.


extension MyClass: ASWebAuthenticationPresentationContextProviding {

@available(iOS 13.0, *)

func presentationAnchor(for session: ASWebAuthenticationSession) -> ASPresentationAnchor {

return UIApplication.shared.keyWindow!

}

}