C++ 无法通过Evernote Api进行授权
我想为Evernote创建一个小客户端 我从网站上获得了消费者密钥和密码,并编写了以下代码:C++ 无法通过Evernote Api进行授权,c++,evernote,C++,Evernote,我想为Evernote创建一个小客户端 我从网站上获得了消费者密钥和密码,并编写了以下代码: struct user_data { std::string login; std::string pass; }; struct evernote_data { user_data user; std::string consumer_key; std::string consumer_secret; }; struct service_data {
struct user_data {
std::string login;
std::string pass;
};
struct evernote_data {
user_data user;
std::string consumer_key;
std::string consumer_secret;
};
struct service_data
{
std::string host;
std::string path;
int port;
};
void connect(const evernote_data& account, const service_data& service)
{
try
{
boost::shared_ptr<TSSLSocketFactory> sslSocketFactory(new TSSLSocketFactory());
boost::shared_ptr<TSSLSocket> sslSocket=sslSocketFactory->createSocket(service.host, service.port);
boost::shared_ptr<TBufferedTransport> bufferedTransport(new TBufferedTransport(sslSocket));
boost::shared_ptr<TTransport> http_client(new THttpClient(bufferedTransport, service.host, service.path));
http_client->open();
boost::shared_ptr<TBinaryProtocol> user_store_protocol(new TBinaryProtocol(http_client));
evernote::edam::UserStoreClient user_store(user_store_protocol, user_store_protocol);
evernote::edam::AuthenticationResult auth_result;
user_store.authenticate(auth_result, account.user.login, account.user.pass, account.consumer_key, account.consumer_secret);
cout << "Some info: " ;
cout << auth_result.user.username << endl << auth_result.user.name << endl << auth_result.user.email << endl;
}
catch(evernote::edam::EDAMUserException& error)
{
cout << "catch EDAMUserException" << endl;
cout << "ErrorCode: " << error.errorCode << endl;
cout << "What: " << error.what() << endl;
cout << "Parameter: " << error.parameter << endl;
}
catch(::apache::thrift::TException& error)
{
cout << "catch thrift::TException " << endl;
cout << "What: " << error.what() << endl;
}
catch(...)
{
cout << "boom !!!" << endl;
}
}
int main()
{
const user_data user = { "**Login**", "**password**"};
const evernote_data account = { user, "***Key***", "**Secret**" };
const service_data service = {"sandbox.evernote.com", "/edam/user", 443 };
connect(account, service);
std::cout << "Exit" << std::endl;
cin.get();
return 0;
}
并始终捕获关于错误的使用者密钥的错误。我做错了什么 自去年11月以来,第三方开发者无法使用UserStore#authenticate。 请改用OAuth。
Catch EDAMUserException
ErrorCode: 8
What: Default TException.
Parameter: consumerKey