             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 ?? "")

            return .Success(DropboxAccessToken(accessToken: accessToken, uid: uid))
        }
    }
    
    /// Try to handle a redirect back into the application
    ///
    /// :param: url
    ///         The URL to attempt to handle
    /// :returns: `nil` if SwiftyDropbox cannot handle the redirect URL, otherwise returns the `DropboxAuthResult`.
    public func handleRedirectURL(url: NSURL) -> DropboxAuthResult? {
        
        if !self.canHandleURL(url) {
            return nil
        }
        
        let result : DropboxAuthResult
        if url.host == "1" { // dauth
            result = extractfromDAuthURL(url)
        } else {
            result = extractFromRedirectURL(url)
        }
        
        switch result {
        case .Success(let token):
            Keychain.set(key: token.uid, value: token.accessToken)

    case ServerError
    case TemporarilyUnavailable
    case Unknown

    init(errorCode: String) {
        switch errorCode {
            case "unauthorized_client": self = .UnauthorizedClient
