MCPcopy Index your code
hub / github.com/anomalyco/opencode / credential

Function credential

packages/core/src/plugin/provider/openai.ts:237–247  ·  view source on GitHub ↗
(methodID: Integration.MethodID, tokens: TokenResponse)

Source from the content-addressed store, hash-verified

235}
236
237function credential(methodID: Integration.MethodID, tokens: TokenResponse) {
238 const accountID = extractAccountID(tokens)
239 return Credential.OAuth.make({
240 type: "oauth",
241 methodID,
242 refresh: tokens.refresh_token,
243 access: tokens.access_token,
244 expires: Date.now() + (tokens.expires_in ?? 3600) * 1000,
245 metadata: accountID ? { accountID } : undefined,
246 })
247}
248
249async function generatePKCE(): Promise<Pkce> {
250 const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~"

Callers 2

openai.tsFile · 0.70
refreshFunction · 0.70

Calls 2

extractAccountIDFunction · 0.85
makeMethod · 0.45

Tested by

no test coverage detected