                 self.loadingView.activityIndicatorView.stp_stopAnimatingAndHide()
                 switch result {
                 case .success(let session):
-                    self.result = .completed(session: session)
-                    self.notifyDelegate()
+                    self.notifyDelegate(result: .completed(session: session))
                 case .failure(let error):
                     self.loadingView.errorView.isHidden = false
-                    self.result = .failed(error: error)
+                    self.fetchSessionError = error
                 }
             }
     }

    weak var delegate: FinancialConnectionsWebFlowViewControllerDelegate?

    private var authSessionManager: AuthenticationSessionManager?
    private var result: FinancialConnectionsSheet.Result = .canceled
    private var hasNotifiedDelegate = false

    private let clientSecret: String
    private let apiClient: FinancialConnectionsAPIClient
    private let sessionFetcher: FinancialConnectionsSessionFetcher
    private let manifest: FinancialConnectionsSessionManifest
    
    // MARK: - UI



extension FinancialConnectionsWebFlowViewController {

    private func notifyDelegate(result: FinancialConnectionsSheet.Result) {
        delegate?.financialConnectionsWebFlow(viewController: self, didFinish: result)
        delegate = nil // prevent the delegate from being called again
    }

    private func startAuthenticationSession(manifest: FinancialConnectionsSessionManifest) {
        loadingView.activityIndicatorView.stp_startAnimatingAndShow()
        authSessionManager = AuthenticationSessionManager(manifest: manifest, window: view.window)
        authSessionManager?
            .start()
            .observe(using: { [weak self] (result) in
                guard let self = self else { return }
                self.loadingView.activityIndicatorView.stp_stopAnimatingAndHide()
                switch result {
                   case .success(.success):
                        self.fetchSession()
                   case .success(.webCancelled):
                       self.notifyDelegate(result: .canceled)
                   case .success(.nativeCancelled):
                       self.notifyDelegate(result: .canceled)
                   case .failure(let error):
                       self.notifyDelegate(result: .failed(error: error))
                   }
        })
    }

    private func fetchSession() {
        loadingView.activityIndicatorView.stp_startAnimatingAndShow()
        loadingView.errorView.isHidden = true
        sessionFetcher
            .fetchSession()
            .observe { [weak self] (result) in
