MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / oauthAccountIdentity

Function oauthAccountIdentity

apps/cli/src/main.ts:2405–2412  ·  view source on GitHub ↗
(connection: ExecutorServerConnection)

Source from the content-addressed store, hash-verified

2403// recognize a re-login to the SAME account (update in place) versus a
2404// different account on the same host (needs its own profile).
2405const oauthAccountIdentity = (connection: ExecutorServerConnection): string | null => {
2406 const auth = connection.auth;
2407 if (!auth || auth.kind !== "oauth") return null;
2408 const claims = decodeAccessTokenClaims(auth.accessToken);
2409 const sub = typeof claims?.sub === "string" ? claims.sub : undefined;
2410 const org = typeof claims?.org_id === "string" ? claims.org_id : undefined;
2411 return sub && org ? `${connection.origin}|${sub}|${org}` : null;
2412};
2413
2414// Name a login's profile by the ACCOUNT it authenticates (email, falling back
2415// to user id), not the hostname, so two accounts on the same server get

Callers 1

chooseLoginProfileNameFunction · 0.85

Calls 1

decodeAccessTokenClaimsFunction · 0.90

Tested by

no test coverage detected