     }
     
     public func unauthorize() throws {
-        try credentialStore.deleteCredential(withIdentifier: OAuth2Credential.identifierWithClientId(dataSource!.clientId(), clientSecret: dataSource!.clientSecret()))
-    }
-    
-    public func isAuthorized() -> Bool {
-        let credential = getCredential()
-        return credential != nil
+        try deleteCredential()
     }
 }
 

    
    func storeCredential(credential: OAuth2Credential) throws {
        try credentialStore.storeCredential(credential, withIdentifier: OAuth2Credential.identifierWithClientId(dataSource!.clientId(), clientSecret: dataSource!.clientSecret()))
    }
}

}

public final class OAuth2PasswordAuthenticator {
    
    public var isAuthorizedSignal: Observable<Bool> {
        return credentialVariable.asObservable()
            .map({$0 != nil})
    }
    
    public var isAuthorized: Bool {
        return credentialVariable.value != nil
    }
    
    public var dataSource: OAuth2PasswordAuthenticatorDataSource? {
        didSet {
            credentialVariable.value = getCredential()
        }
    }
    
    private let networkClient: NetworkClientProtocol
    private let authenticator: Authenticator?
    private var credentialStore: CredentialStore
    private let disposeBag = DisposeBag()
    private var credentialVariable = Variable<Credential?>(nil)
    
    public init(withNetworkClient networkClient: NetworkClientProtocol, authenticator: Authenticator? = nil, credentialStore: CredentialStore = OAuth2DefaultsCredentialStore()) {
        self.networkClient = networkClient
