Changeset - 456f0713a795
[Not reviewed]
0 1 0
Jan Kaluza - 10 years ago 2016-01-24 13:08:09
jkaluza@redhat.com
Fix crash from previous commit
1 file changed with 3 insertions and 2 deletions:
0 comments (0 inline, 0 general)
libtransport/OAuth2.cpp
Show inline comments
 
@@ -86,12 +86,13 @@ std::string OAuth2::requestToken(const std::string &code, std::string &token, st
 
	if (!req.execute(resp)) {
 
		LOG4CXX_ERROR(logger, url);
 
		LOG4CXX_ERROR(logger, req.getError());
 
		return req.getError();
 
	}
 

	
 
	LOG4CXX_ERROR(logger, req.getRawData());
 
	rapidjson::Value& access_token = resp["access_token"];
 
	if (!access_token.IsString()) {
 
		LOG4CXX_ERROR(logger, "No 'access_token' object in the reply.");
 
		LOG4CXX_ERROR(logger, url);
 
		LOG4CXX_ERROR(logger, req.getRawData());
 
		return "No 'access_token' object in the reply.";
 
@@ -104,14 +105,14 @@ std::string OAuth2::requestToken(const std::string &code, std::string &token, st
 
		LOG4CXX_ERROR(logger, req.getRawData());
 
		return "Empty 'access_token' object in the reply.";
 
	}
 

	
 
	rapidjson::Value& bot = resp["bot"];
 
	if (bot.IsObject()) {
 
		rapidjson::Value& bot_access_token = resp["bot_access_token"];
 
		if (!bot_access_token.IsString()) {
 
		rapidjson::Value& bot_access_token = bot["bot_access_token"];
 
		if (bot_access_token.IsString()) {
 
			bot_token = bot_access_token.GetString();
 
		}
 
	}
 

	
 
	return "";
 
}
0 comments (0 inline, 0 general)