注册 登录
n/ai · 5 个月前 · 已编辑 · 1.4 万 次浏览
u/jojodat黄金
n/aiu/jojodat · 5 个月前

Codex SMS WhatsApp验证绕过

受此帖子的启发
https://www.nodeloc.com/t/topic/89806

为了那些不愿信任任何Chrome扩展程序的用户,我让AI生成了一段适用于Chrome或Firefox控制台(按F12打开)的代码,它能实现相同的功能,即生成auth.json文件。

登录后在 chatgpt.com 上使用

fetch('https://chatgpt.com/api/auth/session')
  .then(res => res.json())
  .then(session => {
    if (!session || !session.accessToken) {
      alert("You are not logged into ChatGPT or failed to fetch the session!");
      return;
    }

    // Extract data from the session
    const accountId = session.account?.id || '';
    const email = session.user?.email || '';
    const planType = session.account?.planType || 'free';
    const iat = Math.floor(Date.now() / 1000);
    const exp = session.expires ? Math.floor(new Date(session.expires).getTime() / 1000) : iat + (30 * 24 * 3600);

    // Build a Fake (Synthetic) id_token for Codex
    const jwtHeader = { alg: 'none', typ: 'JWT', cpa_synthetic: true };
    const jwtPayload = {
      iat, exp,
      "https://api.openai.com/auth": {
        chatgpt_account_id: accountId,
        chatgpt_plan_type: planType,
        chatgpt_user_id: session.user?.id || '',
        user_id: session.user?.id || ''
      },
      email
    };

    const base64UrlEncode = (obj) => {
      const str = JSON.stringify(obj);
      const base64 = btoa(unescape(encodeURIComponent(str)));
      return base64.replace(/=/g, '').replace(/\+/g, '-').replace(/\//g, '_');
    };

    const syntheticIdToken = `${base64UrlEncode(jwtHeader)}.${base64UrlEncode(jwtPayload)}.synthetic`;

    // Build the final auth.json structure
    const authConfig = {
      auth_mode: "chatgpt",
      OPENAI_API_KEY: null,
      tokens: {
        id_token: syntheticIdToken,
        access_token: session.accessToken,
        refresh_token: session.sessionToken || "placeholder", // ChatGPT uses sessionToken here
        account_id: accountId
      },
      last_refresh: new Date().toISOString()
    };

    const jsonString = JSON.stringify(authConfig, null, 2);
    
    // Trigger the download of auth.json
    const blob = new Blob([jsonString], { type: 'application/json' });
    const url = URL.createObjectURL(blob);
    const a = document.createElement('a');
    a.href = url;
    a.download = 'auth.json';
    document.body.appendChild(a);
    a.click();
    document.body.removeChild(a);
    URL.revokeObjectURL(url);
    
    console.log("✅ auth.json has been successfully generated and downloaded!");
  })
  .catch(err => console.error("❌ An error occurred:", err));

将下载的文件放到 Codex 认证目录(建议先备份再覆盖):

系统 路径
Windows %USERPROFILE%\.codex\auth.json
macOS / Linux ~/.codex/auth.json
# Windows
New-Item -ItemType Directory -Force -Path "env:USERPROFILE\.codex\auth.json"
# macOS / Linux
mkdir -p ~/.codex
cp ~/Downloads/auth.json ~/.codex/auth.json
chmod 600 ~/.codex/auth.json

在终端运行 Codex,确认不再弹出手机号验证。【Codex APP 重启即可】

83
856
登录后参与讨论。

856 条回复

你在看其中一组对话 查看全部回复
  1. duongdang941 白银 5 个月前
    4
  2. ledi111 青铜 5 个月前

    看看

    0
  3. WeaponChiang 白银 5 个月前

    看啊可能

    0
  4. terry12 白银 5 个月前

    看看

    0
  5. qingyu 白银 5 个月前

    什么

    0
  6. lichangrui 青铜 5 个月前

    看看

    0
  7. wahabdinn1 白银 5 个月前

    waw we have need to take a look

    0
  8. devwithjuned 白银 5 个月前

    have a loook

    0
  9. ahmad_rahman 白银 5 个月前
    这条回复已被版主删除
  10. ahmad_rahman 白银 5 个月前

    let me check

    0
  11. leonxie 白银 5 个月前
    这条回复已被版主删除
  12. ahmad_rahman 白银 5 个月前

    let me look

    0
  13. metucky 白银 5 个月前

    看看

    0
  14. metucky 白银 5 个月前

    看看

    0
  15. hiv 白银 4 个月前

    have a loook

    0
  16. ricatix 白银 4 个月前

    我们会看到

    0
  17. luminzon 白银 4 个月前

    看看

    0
  18. Afif_No 白银 4 个月前

    看啊可能

    0
  19. yk0007 青铜 4 个月前

    看看

    0
  20. Nova_Hoang 白银 4 个月前

    我们来看一下。

    0