public Observable<Token> register(String email, String pass) { Timber.v("Creating new account " + email); return mUserManager .register(email, pass) .flatMap( token -> { mPreferenceHelper.storeToken(token.getAccessToken()); Intent intent = mAuthenticationManager.generateAuthIntent(token, email, pass); mAuthenticationManager.completeLogin(intent); return Observable.just(token); }); }
public Observable<Token> authenticate(final String email, final String pass) { Timber.v("Authenticating " + email); return mUserManager .login(email, pass) .flatMap( token -> { mPreferenceHelper.storeToken(token.getAccessToken()); Intent intent = mAuthenticationManager.generateAuthIntent(token, email, pass); mAuthenticationManager.completeLogin(intent); return Observable.just(token); }); }