Binary files BitcasaDiff-20140717/BitcasaDiff/BitcasaDiff.rc and BitcasaDiff-20140717b/BitcasaDiff/BitcasaDiff.rc differ
diff -urN --strip-trailing-cr BitcasaDiff-20140717/BitcasaDLL/BitcasaAPI.cpp BitcasaDiff-20140717b/BitcasaDLL/BitcasaAPI.cpp
--- BitcasaDiff-20140717/BitcasaDLL/BitcasaAPI.cpp	2014-07-16 18:24:22.319433900 +0900
+++ BitcasaDiff-20140717b/BitcasaDLL/BitcasaAPI.cpp	2014-07-16 23:54:06.405018900 +0900
@@ -301,15 +301,20 @@
 //	Grant access_token
 int BitcasaAPI::Grant_token(std::string auth_code)
 {
-	bitcasa.Clear();
-	bitcasa.request.query["code"] = auth_code;
-	bitcasa.request.query["secret"] = ClientSecret;
-	bitcasa.GET(API_Granttoken);
+	int retrycount = 5;
+	while (retrycount-- > 0) {
+		bitcasa.Clear();
+		bitcasa.request.query["code"] = auth_code;
+		bitcasa.request.query["secret"] = ClientSecret;
+		bitcasa.GET(API_Granttoken);
 
-	if (bitcasa.response.code != 200) {
-		std::cout << "Grant access_token failed" << std::endl;
-		return 1;
+		if (bitcasa.response.code == 200) break;
+
+		std::wcout << "Grant access_token failed" << std::endl;
+		std::wcout << bitcasa.response.code << std::endl;
 	}
+	if (retrycount == 0) return 1;
+
 	auto result = jsonitem::Create(&bitcasa.response.body[0]);
 	auto token = (*(*result)["result"])["access_token"]->GetString();
 	access_token = token;
