public Observable < BackendUser > getUserFromAuthToken ( final String authToken ) { return Observable . create ( new Observable . OnSubscribe < BackendUser > ( ) { @ Override public void call ( Subscriber < ? super BackendUser > subscriber ) { try { setLoginState ( LOGGING_IN ) ; logger . debug ( "getWebService(): " + getWebService ( ) ) ; logger . debug ( "getuserFromAuthToken: " + authToken ) ; ValidCredentials validCredentials = getWebService ( ) . getUserFromAuthToken ( authToken ) . toBlocking ( ) . first ( ) ; if ( validCredentials == null ) throw new Exception ( "Null User Returned" ) ; subscriber . onNext ( setUser ( validCredentials ) ) ; } catch ( Exception e ) { setLoginState ( LOGGED_OUT ) ; subscriber . onError ( e ) ; } } } ) ; }
Login using user authentication token