MCPcopy Create free account
hub / github.com/bumptop/BumpTop / getAccessToken

Method getAccessToken

trunk/win/Source/OAuthClient.cpp:113–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111}
112
113bool OAuthClient::getAccessToken( QString accessTokenRequestUri, QString oauthVerifierToken )
114{
115 _accessTokenRequestUri = accessTokenRequestUri;
116
117 // skip this whole process if we already have an access token
118 if (!GLOBAL(settings).tw_oauth_key.isEmpty() &&
119 !GLOBAL(settings).tw_oauth_secret.isEmpty())
120 {
121 _tKey = GLOBAL(settings).tw_oauth_key;
122 _tSecret = GLOBAL(settings).tw_oauth_secret;
123 return true;
124 }
125
126 // otherwise, obtain the access token
127 QHash<QString, QString> params;
128 params.insert("oauth_verifier", oauthVerifierToken);
129 prepareParameters(_accessTokenRequestUri, "POST", params);
130 QString result = postHttpRequest(_accessTokenRequestUri, params);
131 if (!result.isEmpty())
132 {
133 // example: oauth_token=hh5s93j4hdidpola&oauth_token_secret=hdhd0244k9j7ao03
134 QHash<QString, QString> newParams;
135 if (extractParams(result, newParams))
136 {
137 if (extractTokens(newParams, true))
138 {
139 return true;
140 }
141 }
142 }
143 return false;
144}
145
146bool OAuthClient::launchAuthorizationUrl( QString authorizationLaunchUrl )
147{

Callers 1

initializeMethod · 0.80

Calls 2

isEmptyMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected