登录到亚马逊没有浏览器
Login to Amazon without Browser
我正在windows下用c++编写一个应用程序,与亚马逊云服务一起工作。我需要在网站上获得授权与特定的数据工作,我想获得访问令牌。问题是,我想,我不使用浏览器获得授权,但我不明白如何。我在项目中使用cURL并发送如下请求:
int main(void) {
CURL *curl;
CURLcode res;
struct curl_slist *list = NULL;
FILE *Response = fopen("Response.txt", "wb+");
curl = curl_easy_init();
if (curl) {
curl_easy_setopt(curl, CURLOPT_URL, "https://www.amazon.com/ap/oa?client_id=%MY CLIENT ID%scope=clouddrive:read_all&response_type=token&redirect_uri=http://localhost");
list = curl_slist_append(list, "Accept: text/html");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, list);
curl_easy_setopt(curl, CURLOPT_HTTPGET, 1L);
curl_easy_setopt(curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, SaveData);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, Response);
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
/* Perform the request, res will get the return code */
res = curl_easy_perform(curl);
/* Check for errors */
if (res != CURLE_OK)
fprintf(Response, "curl_easy_perform() failed: %sn",
curl_easy_strerror(res));
curl_slist_free_all(list);
/* always cleanup */
curl_easy_cleanup(curl);
}
当我得到响应时,我有一个带有HTML授权页的文件副本。以下是部分答案/
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type='text/javascript'>var ue_t0=ue_t0||+new Date();</script>
<script type='text/javascript'>
var ue_csm = window,
ue_hob = +new Date();
如果我不能使用浏览器,而我可以用Web浏览器打开一个小窗口(没有框架)并从服务器接收数据(访问令牌)。文档中没有任何内容(亚马逊文档)。
如果你想让你的应用程序与AWS"对话",你应该使用他们的api,而不是web控制台。API请求是无状态的,并且使用凭据签名,并且不像web控制台那样依赖于身份验证会话。
他们有许多流行语言的官方sdk,但不幸的是没有c++的。所以,除非你在某个地方找到一个,否则你将不得不实现你自己的客户端,但它都是基于HTTP的。
另一个值得一提的是,每个产品都有一个独立的API (EC2、S3、RDS等)。据我所知,您不可能找到适用于所有AWS产品的一体化API。文档可能也有点稀疏,但大多数产品都覆盖得很好。好运。div;)
相关文章:
- 如何将不同的可执行文件合并到一个窗口框架中进行编码?像浏览器一样
- 应用程序无法找到铬边缘浏览器
- 如何从WebAssembly模块检测浏览器信息?
- 将音频从浏览器流式传输到WebRTC本机C++应用程序
- c++ 网络浏览器块 url
- 带有剪裁下溢的夏亚减法
- 谷歌浏览器在访问网站时发送第二个 0 长度的请求?
- 马洛克会在 C++17 年返回"invalid pointer value"吗?
- 亚马逊在线评估编码问题,以找到第n个几何级数
- C++ 获取"控件可能会到达约翰逊-特罗特代码上的非空函数的末尾
- 我的web应用程序的用户需要在浏览器上手动启用本机客户端吗
- C++检查网络浏览器是否关闭
- 使用 Cmake 闪烁浏览器引擎示例?
- 如何在亚马逊kinesis_video_gstreamer_sample_app.cpp中更改视频源?
- 使用 PyUblas、Boost.Python 和 py_tsg 从 python 访问塔斯马尼亚稀疏网格.make_g
- 亚马逊,产品广告 API,签名请求 (C++)
- 在VMWare机器上编译的程序在亚马逊服务器上运行时会因非法指令而崩溃
- 为什么我的签名与亚马逊的例子不同?(C++/REST/授权签名版本4)
- c++ pthread多线程2倍Intel Xeon X5570,四核cpu在亚马逊EC2 HPC ubuntu实例
- 登录到亚马逊没有浏览器