当尝试使用chilkat库在c ++中实现时,带有邮递员接口的工作邮递请求不起作用,邮递员得到响应200,程序得到401(未授权)。 我正在用chilkat的示例进行休息后请求。
无论您在哪里看到用户名和密码,都将填写有效值。
休息休息;
// Make the initial connection (without sending a request yet).
bool bTls = true;
int port = 443;
bool bAutoReconnect = true;
success = rest.Connect("https://dev-182721.oktapreview.com",port,bTls,bAutoReconnect);
if (success != true) {
std::cout << rest.lastErrorText() << "\r\n";
return;
}
rest.put_Authorization("username:password");
rest.authorization();
rest.AddHeader("Content-Type","application/x-www-form-urlencoded");
// Provide query params.
rest.AddQueryParam("grant_type","password");
rest.AddQueryParam("redirect_uri","http://localhost");
rest.AddQueryParam("username","username");
rest.AddQueryParam("password","password");
rest.AddQueryParam("scope","openid");
const char *responseStr=
rest.fullRequestFormUrlEncoded("POST","/oauth2/default/v1/token");
if (rest.get_LastMethodSuccess() != true) {
std::cout << rest.lastErrorText() << "\r\n";
return;
}
// When successful, the response status code will equal 200.
任何人都可以帮助我找出丢失的内容