MCPcopy Create free account
hub / github.com/Selectively11/CloudRedirect / LoadTokens

Method LoadTokens

src/common/cloud_provider_base.cpp:73–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71// ── Token lifecycle ────────────────────────────────────────────────────────
72
73bool CloudProviderBase::LoadTokens() {
74 if (!m_tokenStore) {
75 LOG("%s LoadTokens: no token store configured", LogTag());
76 return false;
77 }
78 auto content = m_tokenStore->Read(m_tokenPath);
79 if (content.empty()) {
80 // Token store already logged the specific error
81 return false;
82 }
83 auto j = Json::Parse(content);
84 m_tok.access = j["access_token"].str();
85 m_tok.refresh = j["refresh_token"].str();
86 m_tok.expiresAt = j["expires_at"].integer();
87 if (m_tok.refresh.empty()) {
88 LOG("%s LoadTokens: token file exists but refresh_token is empty/missing", LogTag());
89 return false;
90 }
91 return true;
92}
93
94bool CloudProviderBase::SaveTokens() {
95 if (!m_tokenStore) return false;

Callers

nothing calls this directly

Calls 3

integerMethod · 0.80
ParseFunction · 0.70
ReadMethod · 0.45

Tested by

no test coverage detected