         }
         return components.URL!
     }
-    
+
     private func canHandleURL(url: NSURL) -> Bool {
         for known in [self.redirectURL, self.dauthRedirectURL] {
             if (url.scheme == known.scheme &&  url.host == known.host && url.path == known.path) {

            return .Error(.AccessDenied, "User cancelled Dropbox link")
        }
    }
    
    private func extractFromRedirectURL(url: NSURL) -> DropboxAuthResult {
        var results = [String: String]()
        let pairs  = url.fragment?.componentsSeparatedByString("&") ?? []
        
        for pair in pairs {
            let kv = pair.componentsSeparatedByString("=")
            results.updateValue(kv[1], forKey: kv[0])
        }
        
        if let error = results["error"] {
            let desc = results["error_description"]?.stringByReplacingOccurrencesOfString("+", withString: " ").stringByReplacingPercentEscapesUsingEncoding(NSASCIIStringEncoding)
            return .Error(OAuth2Error(errorCode: error), desc ?? "")

    public func clearStoredAccessToken(token: DropboxAccessToken) -> Bool {
        return Keychain.delete(token.uid)
    }

    /// Delete all stored access tokens
    ///
    /// :returns: whether the operation succeeded
    public func clearStoredAccessTokens() -> Bool {
        return Keychain.clear()
    }

    /// Save an access token
    ///
    /// :param: token
