Slack: redirect to https instead of http

This commit is contained in:
Jan Kaluza 2016-01-24 12:04:14 +01:00
parent 6d52c33782
commit 6fc502c3c9
2 changed files with 13 additions and 1 deletions

View file

@ -84,15 +84,27 @@ std::string OAuth2::requestToken(const std::string &code, std::string &token) {
rapidjson::Document resp;
HTTPRequest req(HTTPRequest::Get, url);
if (!req.execute(resp)) {
LOG4CXX_ERROR(logger, url);
LOG4CXX_ERROR(logger, req.getError());
return req.getError();
}
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.";
}
token = access_token.GetString();
if (token.empty()) {
LOG4CXX_ERROR(logger, "Empty 'access_token' object in the reply.");
LOG4CXX_ERROR(logger, url);
LOG4CXX_ERROR(logger, req.getRawData());
return "Empty 'access_token' object in the reply.";
}
return "";
}

View file

@ -62,7 +62,7 @@ SlackUserRegistration::~SlackUserRegistration(){
}
std::string SlackUserRegistration::createOAuth2URL(const std::vector<std::string> &args) {
std::string redirect_url = "http://slack.spectrum.im/oauth2/" + CONFIG_STRING(m_config, "service.jid");
std::string redirect_url = "https://slack.spectrum.im/oauth2/" + CONFIG_STRING(m_config, "service.jid");
OAuth2 *oauth2 = new OAuth2(CONFIG_STRING_DEFAULTED(m_config, "service.client_id",""),
CONFIG_STRING_DEFAULTED(m_config, "service.client_secret",""),
"https://slack.com/oauth/authorize",