You will need a catchError function to recover from an error and launch a new observable that triggers an alternative behavior.
So, for example, you need a manufacturer that gets a username and password ...
let credentialInput = Observable.combineLatest(usernameLabel.rx_text, passwordLabel.rx_text)
You will probably want to wait until the user closes the Login button ...
let credentials = credentialInput.sample(loginButton.rx_tap)
Then enter the token.
let loaToken = credentials.flatMap { serverLogin($0, $1) }.catchError { error in if error == loa3Error { return getLOA3Data().flatMap { loa3ServerLogin($0) } } else { throw error } }
getLOA3Data is a function that returns an Observable that contains the data needed for loa3 authentication.
The above is of course pseudo code, but I expect it to give you a good idea on how to wrap your head around a problem.
source share