云推送 权限验证失败 50
在使用百度云推送的接口出现权限验证失败,报错:{"request_id":23356184,"error_code":20265,"error_msg":"Authent...
在使用百度云推送的接口出现权限验证失败,报错:{"request_id":23356184,"error_code":20265,"error_msg":"Authentication failed"}
代码都检查了无数遍了,都没有什么问题,有大神指点一下嘛
用c++实现的
void CenterSchedule::HandleTuisongSingleDevice(const std::string channel_id, const std::string account_id)
{
std::string url = GET_CONFIG_STRING("tuisong_single_url", "");
std::string api_key = GET_CONFIG_STRING("api_key", "");
std::string secret_key = GET_CONFIG_STRING("secret_key", "");
int cur_time = (int)time(0);
SimpleJsonObject object;
object["title"] = "hello";
object["description"] = "helloworld";
std::string result;
object.GetResult(result);
std::map<std::string, std::string> param_list;
param_list["apikey"] = api_key;
param_list["timestamp"] = Utility::FormateToString(cur_time);
param_list["expires"] = Utility::FormateToString((cur_time)+60*60*24);
param_list["device_type"] = "3";
param_list["channel_id"] = channel_id;
param_list["msg"] = result;
param_list["msg_type"] = "1";
std::string sign = ALittle::CommonHelp::TuisongSign(param_list, "POST", url, secret_key);
std::string param = "apikey=" + api_key
+ "×tamp=" + Utility::FormateToString(cur_time)
+ "&expires=" + Utility::FormateToString((cur_time)+60*60*24)
+ "&device_type=3"
+ "&sign=" + sign
+ "&msg_type=1"
+ "&channel_id=" + channel_id
+ "&msg=" + result;
param = STRING_2_UTF8(HttpSystem::UrlEncode(param).c_str());
ALITTLE_INFO("param = " << param);
std::string add_header = "Content-Type: application/x-www-form-urlencoded;charset=utf-8\r\n";
add_header += "User-Agent: BCCS_SDK/3.0 (Darwin; Darwin Kernel Version 14.0.0: Fri Sep 19 00:26:44 PDT 2014; root:xnu-2782.1.97~2/RELEASE_X86_64; x86_64) PHP/5.6.3 (Baidu Push Server SDK V3.0.0 and so on..) cli/Unknown ZEND/2.6.0\r\n";
std::function<void(bool, const std::string&, const std::string&)> func;
func = std::bind(HandleBaiduTuisongReuslt, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3);
ALittle::HttpSystem::SendRequestPostJson(url, param, func, add_header);
} 展开
代码都检查了无数遍了,都没有什么问题,有大神指点一下嘛
用c++实现的
void CenterSchedule::HandleTuisongSingleDevice(const std::string channel_id, const std::string account_id)
{
std::string url = GET_CONFIG_STRING("tuisong_single_url", "");
std::string api_key = GET_CONFIG_STRING("api_key", "");
std::string secret_key = GET_CONFIG_STRING("secret_key", "");
int cur_time = (int)time(0);
SimpleJsonObject object;
object["title"] = "hello";
object["description"] = "helloworld";
std::string result;
object.GetResult(result);
std::map<std::string, std::string> param_list;
param_list["apikey"] = api_key;
param_list["timestamp"] = Utility::FormateToString(cur_time);
param_list["expires"] = Utility::FormateToString((cur_time)+60*60*24);
param_list["device_type"] = "3";
param_list["channel_id"] = channel_id;
param_list["msg"] = result;
param_list["msg_type"] = "1";
std::string sign = ALittle::CommonHelp::TuisongSign(param_list, "POST", url, secret_key);
std::string param = "apikey=" + api_key
+ "×tamp=" + Utility::FormateToString(cur_time)
+ "&expires=" + Utility::FormateToString((cur_time)+60*60*24)
+ "&device_type=3"
+ "&sign=" + sign
+ "&msg_type=1"
+ "&channel_id=" + channel_id
+ "&msg=" + result;
param = STRING_2_UTF8(HttpSystem::UrlEncode(param).c_str());
ALITTLE_INFO("param = " << param);
std::string add_header = "Content-Type: application/x-www-form-urlencoded;charset=utf-8\r\n";
add_header += "User-Agent: BCCS_SDK/3.0 (Darwin; Darwin Kernel Version 14.0.0: Fri Sep 19 00:26:44 PDT 2014; root:xnu-2782.1.97~2/RELEASE_X86_64; x86_64) PHP/5.6.3 (Baidu Push Server SDK V3.0.0 and so on..) cli/Unknown ZEND/2.6.0\r\n";
std::function<void(bool, const std::string&, const std::string&)> func;
func = std::bind(HandleBaiduTuisongReuslt, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3);
ALittle::HttpSystem::SendRequestPostJson(url, param, func, add_header);
} 展开
1个回答
展开全部
文件损失,不完整,导致传输过程验证失败。 文件使用中,比如在杀毒或者编辑中的文件,系统占用是不能传输的。 权限不足,比如针对某些用户,是不能传输部分
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
尚小云
2024-12-17 广告
2024-12-17 广告
云服务器是基于云计算技术的虚拟化计算资源,提供按需使用的CPU、内存、存储等服务。它如同放置在云端的个人电脑,用户可以快速创建、配置和管理,根据需求弹性伸缩资源,无需关心底层硬件。云服务器主要用于托管网站、运行应用程序、处理数据和提供在线服...
点击进入详情页
本回答由尚小云提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询