             headerParameters: headerParameters,
             messageBody: form.joined(separator: "&").data(using: .utf8)
         )
-        request.responseObject { (response: RestResponse<IAMToken>) in
-            switch response.result {
-            case .success(let token):
-                self.token = token
-                completionHandler(token, nil)
-            case .failure(let error):
+        request.responseObject { (response: WatsonResponse<IAMToken>?, error) in
+            guard let token = response?.result, error == nil else {
                 completionHandler(nil, error)
-            }
+                return
+            }
+            completionHandler(token, nil)
         }
     }
 

            headerParameters: headerParameters,
            messageBody: form.joined(separator: "&").data(using: .utf8)
        )
        request.responseObject { (response: RestResponse<IAMToken>) in
            switch response.result {
            case .success(let token):
                self.token = token
                completionHandler(token, nil)
            case .failure(let error):
                completionHandler(nil, error)
            }
        }
    }
}

            url: tokenURL,
            headerParameters: [:])

        request.response { (response: WatsonResponse<String>?, error) in
            guard error == nil else {
                completionHandler(nil, error)
                return
            }
            guard let token = response?.result else {
                completionHandler(nil, RestError.noData)
                return
            }
            self.token = token
            completionHandler(token, nil)
        }
    }

