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

Function storeTokenInSecretService

ui-linux/src/oauthservice.cpp:103–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101}
102
103static bool storeTokenInSecretService(const QString& provider, const QString& account, const QString& json) {
104 initSecretService();
105 if (!g_secretServiceAvailable) return false;
106
107 GError* error = nullptr;
108 QString label = QString("CloudRedirect %1 token").arg(provider);
109
110 int ok = secret_password_store_sync(
111 &g_tokenSchema, "default", label.toUtf8().constData(), json.toUtf8().constData(),
112 nullptr, &error,
113 "provider", provider.toUtf8().constData(),
114 "account", account.toUtf8().constData(),
115 nullptr);
116
117 if (error) {
118 qDebug() << "[TokenStorage] Secret Service store failed:" << error->message;
119 g_error_free(error);
120 return false;
121 }
122
123 return ok != 0;
124}
125
126// Extract provider and account from token path
127// Path format: ~/.config/CloudRedirect/tokens/{provider}_{account}.json

Callers 1

exchangeCodeForTokensMethod · 0.85

Calls 1

initSecretServiceFunction · 0.85

Tested by

no test coverage detected