AuthWebViewViewModel

  • The web view, once it got an endpoint, should be intercepting requests to URLs matching this one (possibly with different query items) and feeding them via handleRedirect().

  • looksLikeRedirectURL(url:) Default implementation

    true if the given URL looks like a redirect one. Just a helper for the view, optional for the view model.

    Note that comparing prefixes of two URLs can cover many cases, but won’t be correct when query parameters are added before the ones existing in the original redirect URL.

    Default Implementation

  • Called by the web view when it detects a redirect to a URL matching redirectURL.

  • Called by the web view to indicate that it was unable to open the endpoint. (The error is only for diagnostics.)

  • If true, then navigation errors are reported via handleFailureToOpenEndpoint only for the initial navigation to the authorization endpoint; errors loading any other pages are ignored. Might be handy for some non-clean implementations.

  • Called by any party to indicate that the user wants to cancel the flow. It should be safe to call this regardless of the current state.