muhammadzain.tsx
05/07/2026, 12:51 PMtypescript
// after connect with composio
let githubToken: string | undefined;
try {
const entity = await composio.getEntity(buildData.userId);
const connection = await entity.getConnection({ appName: "github" });
githubToken = connection.connectionParams?.access_token; // this value always 'REDACTED'
} catch (e) {
console.warn(
`[Orchestrator] GitHub token not found for user ${buildData.userId}`,
);
}
typescript
// use the github token to clone the repository
async function cloneRepository(
sandbox: Sandbox,
repoUrl: string,
branch: string = "main",
githubToken?: string,
workDir: string = "/home/user/project"
) {
const normalizedUrl = normalizeRepoUrl(repoUrl);
const authUrl = withGitHubToken(normalizedUrl, githubToken);
const cloneCmd = `git clone --depth 1 --branch ${shellEscape(branch)} ${shellEscape(authUrl)} ${shellEscape(workDir)}`;
console.log(`Cloning: ${redactGitCredentials(authUrl)}`);
// the result always "Git clone authentication failed. Ensure the GitHub token is valid and has access to this repository"
const result = await sandbox.commands.run(cloneCmd, {
envs: { GIT_TERMINAL_PROMPT: "0" },
timeoutMs: 5 * 60 * 1000,
});
if (result.exitCode !== 0) {
const error = result.stderr || result.stdout;
if (isGitAuthError(error)) {
throw new Error("Git clone authentication failed, access token is missing");
}
if (isGitRepoNotFound(error)) {
throw new Error("Repository not Found");
}
throw new Error(`Git clone failed: ${error}`);
}
return true;
}Uday
05/07/2026, 7:20 PMREDACTED token is actually due to a recent change on our end. You can refer to this [changelog](https://docs.composio.dev/docs/changelog/2026/04/22) for more details.That said, the token masking is only applied to connected accounts using Composio's managed OAuth app, you should still be able to retrieve tokens from connected accounts using custom credentials. That said, I can temporarily add your project to our feature flag, which will give you enough time to migrate. Lmk.