MCPcopy Create free account
hub / github.com/audacity/audacity / AuthoriseCode

Method AuthoriseCode

libraries/lib-cloud-audiocom/OAuthService.cpp:296–324  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

294}
295
296void OAuthService::AuthoriseCode(
297 const ServiceConfig& config, std::string_view authorizationCode, bool useAudioComRedirectURI,
298 AudiocomTrace trace, std::function<void(std::string_view)> completedHandler)
299{
300 using namespace rapidjson;
301
302 Document document;
303 document.SetObject();
304
305 WriteCommonFields(document, "authorization_code", "all");
306
307 document.AddMember(
308 "code", StringRef(authorizationCode.data(), authorizationCode.size()),
309 document.GetAllocator());
310
311 const auto redirectURI = useAudioComRedirectURI ? config.GetOAuthRedirectURL() : std::string("audacity://link");
312
313 document.AddMember(
314 "redirect_uri", StringRef(redirectURI.data(), redirectURI.size()),
315 document.GetAllocator());
316
317 rapidjson::StringBuffer buffer;
318 rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
319 document.Accept(writer);
320
321 DoAuthorise(
322 config, { buffer.GetString(), buffer.GetSize() }, trace,
323 std::move(completedHandler), false);
324}
325
326bool OAuthService::HasAccessToken() const
327{

Callers

nothing calls this directly

Calls 7

WriteCommonFieldsFunction · 0.85
moveFunction · 0.85
GetOAuthRedirectURLMethod · 0.80
dataMethod · 0.45
sizeMethod · 0.45
GetStringMethod · 0.45
GetSizeMethod · 0.45

Tested by

no test coverage detected