ベアラトークンのモデル作成。その他

This commit is contained in:
keita
2022-04-23 20:56:50 +09:00
parent 5eef4a64e6
commit 9f2c61b7e0
10 changed files with 136 additions and 16 deletions
+10 -1
View File
@@ -2,6 +2,7 @@
#include <cocoatweet/util/util.h>
#include <iostream>
#include <cocoatweet/authentication/oauth.h>
namespace CocoaTweet::API::OAuth1 {
AccessToken::AccessToken() {
contentType_ = "application/x-www-form-urlencoded";
@@ -18,8 +19,16 @@ void AccessToken::oauthToken(const CocoaTweet::API::Model::OAuthToken _token) {
const CocoaTweet::API::Model::OAuthToken AccessToken::process(
std::weak_ptr<CocoaTweet::Authentication::AuthenticatorBase> _oauth) {
auto key = oauth_.lock()->key();
key.authType(CocoaTweet::Authentication::Key::AUTH_TYPE::OAUTH10A);
key.accessToken(oauthToken_.oauthToken());
key.accessTokenSecret(oauthToken_.oauthTokenSecret());
auto oauth = std::make_shared<CocoaTweet::Authentication::OAuth1>(key);
CocoaTweet::API::Model::OAuthToken oauthToken;
HttpPost::process(_oauth, [&oauthToken](const std::string& _rcv) {
HttpPost::process(oauth, [&oauthToken](const std::string& _rcv) {
auto mp = CocoaTweet::Util::parse(_rcv, '&', '=');
if (mp.count("oauth_token")) {
oauthToken.oauthToken(mp.at("oauth_token"));