                 self.credentials = nil
             }
         }
+
         OAuthClient.validKeychain = true
     }
 }

//

import Alamofire
import Marshal
import KeychainAccess

/// OAuthClient manages the OAuth requests. It is responsible for:
/// - the inital login which obtains the refresh token.

    var credentials: Credentials? {
        didSet {
            if let credentials = credentials {
                do {
                    try keychain.set(credentials, key: OAuthClient.credentials)
                }
                catch let error {
                    Log.error("Error setting auth credentials to keychain: \(error.localizedDescription)")
                }
            }
            else {
                do {
                    try keychain.remove(OAuthClient.credentials)
                }
                catch let error {
                    Log.error("Error removing auth credentials from keychain: \(error.localizedDescription)")
                }
            }
            // If there were credentials, and there no longer are, post a notification
            if oldValue != nil && credentials == nil {
