MCPcopy Create free account
hub / github.com/QLHazyCoder/FlowPilot / buildOpenAiCredentials

Function buildOpenAiCredentials

content/sub2api-panel.js:240–266  ·  view source on GitHub ↗
(exchangeData)

Source from the content-addressed store, hash-verified

238}
239
240function buildOpenAiCredentials(exchangeData) {
241 const credentials = {};
242 const allowedKeys = [
243 'access_token',
244 'refresh_token',
245 'id_token',
246 'expires_at',
247 'email',
248 'chatgpt_account_id',
249 'chatgpt_user_id',
250 'organization_id',
251 'plan_type',
252 'client_id',
253 ];
254
255 for (const key of allowedKeys) {
256 if (exchangeData?.[key] !== undefined && exchangeData?.[key] !== null && exchangeData?.[key] !== '') {
257 credentials[key] = exchangeData[key];
258 }
259 }
260
261 if (!credentials.access_token) {
262 throw new Error('SUB2API 交换授权码后未返回 access_token。');
263 }
264
265 return credentials;
266}
267
268function buildOpenAiExtra(exchangeData) {
269 const extra = {};

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected