add http auth url
This commit is contained in:
parent
af81b96333
commit
319a51c37c
|
@ -26,11 +26,11 @@
|
||||||
#include "utils_httpc.h"
|
#include "utils_httpc.h"
|
||||||
#include "uiot_export_http.h"
|
#include "uiot_export_http.h"
|
||||||
|
|
||||||
#define UIOT_MY_PRODUCT_SN "PRODUCT_SN"
|
#define UIOT_MY_PRODUCT_SN "nvtmx50n2j9nilik"
|
||||||
|
|
||||||
#define UIOT_MY_DEVICE_SN "DEVICE_SN"
|
#define UIOT_MY_DEVICE_SN "tlilyffhh3aqi6zx"
|
||||||
|
|
||||||
#define UIOT_MY_DEVICE_SECRET "DEVICE_SECRET"
|
#define UIOT_MY_DEVICE_SECRET "l0310dqp3rjciupw"
|
||||||
|
|
||||||
#define UIOT_PUBLISH_TOPIC "%s/%s/upload/event"
|
#define UIOT_PUBLISH_TOPIC "%s/%s/upload/event"
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "lite-utils.h"
|
#include "lite-utils.h"
|
||||||
#include "ca.h"
|
#include "ca.h"
|
||||||
#include "utils_sha2.h"
|
#include "utils_sha2.h"
|
||||||
|
#include "uiot_export.h"
|
||||||
|
|
||||||
int IOT_HTTP_Get_Token(const char *product_sn, const char *device_sn, const char *device_sercret, char *token)
|
int IOT_HTTP_Get_Token(const char *product_sn, const char *device_sn, const char *device_sercret, char *token)
|
||||||
{
|
{
|
||||||
|
@ -87,9 +88,8 @@ int IOT_HTTP_Get_Token(const char *product_sn, const char *device_sn, const char
|
||||||
HAL_Snprintf(http_client_post->header, 1024, "Content-Type: application/json\r\nAuthorization: %s\r\nbody: %s\r\n",mac_output_char,http_data_post->post_buf);
|
HAL_Snprintf(http_client_post->header, 1024, "Content-Type: application/json\r\nAuthorization: %s\r\nbody: %s\r\n",mac_output_char,http_data_post->post_buf);
|
||||||
|
|
||||||
const char *ca_crt = iot_https_ca_get();
|
const char *ca_crt = iot_https_ca_get();
|
||||||
char *url = (char *)"https://http-cn-sh2.iot.ucloud.cn/auth";
|
|
||||||
|
|
||||||
ret = http_client_common(http_client_post, url, 443, ca_crt, HTTP_POST, http_data_post,5000);
|
ret = http_client_common(http_client_post, UIOT_AUTH_URL, 443, ca_crt, HTTP_POST, http_data_post,5000);
|
||||||
if(SUCCESS_RET != ret)
|
if(SUCCESS_RET != ret)
|
||||||
{
|
{
|
||||||
LOG_ERROR("HTTP_POST error\n");
|
LOG_ERROR("HTTP_POST error\n");
|
||||||
|
|
|
@ -57,14 +57,15 @@ extern "C" {
|
||||||
/* MQTT连接域名 */
|
/* MQTT连接域名 */
|
||||||
//上海区域域名
|
//上海区域域名
|
||||||
#define UIOT_MQTT_DIRECT_DOMAIN "mqtt-cn-sh2.iot.ucloud.cn"
|
#define UIOT_MQTT_DIRECT_DOMAIN "mqtt-cn-sh2.iot.ucloud.cn"
|
||||||
|
#define UIOT_AUTH_URL "https://http-cn-sh2.iot.ucloud.cn/auth"
|
||||||
#define UIOT_UPLOAD_FILE_URL "https://file-cn-sh2.iot.ucloud.cn/api/v1/url"
|
#define UIOT_UPLOAD_FILE_URL "https://file-cn-sh2.iot.ucloud.cn/api/v1/url"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
//使用广州区域时替换为
|
//使用广州区域时替换为
|
||||||
#define UIOT_MQTT_DIRECT_DOMAIN "mqtt-cn-gd.iot.ucloud.cn"
|
#define UIOT_MQTT_DIRECT_DOMAIN "mqtt-cn-gd.iot.ucloud.cn"
|
||||||
|
#define UIOT_AUTH_URL "https://http-cn-gd.iot.ucloud.cn/auth"
|
||||||
#define UIOT_UPLOAD_FILE_URL "https://file-cn-gd.iot.ucloud.cn/api/v1/url"
|
#define UIOT_UPLOAD_FILE_URL "https://file-cn-gd.iot.ucloud.cn/api/v1/url"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "uiot_export_mqtt.h"
|
#include "uiot_export_mqtt.h"
|
||||||
#include "uiot_defs.h"
|
#include "uiot_defs.h"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue