注册 登录
n/ai · 5 个月前 · 已编辑 · 1.2 万 次浏览
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
登录后参与讨论。
海外原生IP VPS,稳定访问全球网络

还在为IP不纯、平台风控、频繁验证而烦恼? 丽萨主机海外原生IP VPS,双ISP住宅IP,覆盖美国、香港、日本、新加坡、台湾、德国、越南、英国等热门地区,适合跨境电商、社媒运营、AI工具、流媒体及海外业务使用。

lisahost.com 了解更多

856 条回复

排序
  1. Arvin_Leung 🚗 荣耀 Solved 2 5 个月前 #2

    这个我记得好像有人发过了.

    4
  2. WenjieChou 黄金 不离不弃 5 个月前 #3

    看看捏

    1
  3. hhoo 白银 5 个月前 #4

    感谢分享

    2
  4. html 黄金 5 个月前 #5

    从聊天页获取token?

    1
  5. zack2026 白银 5 个月前 #6

    thank you

    0
  6. la_ka 白银 5 个月前 #7

    看看行不行

    1
  7. lleo 黄金 5 个月前 #8

    看看

    1
  8. wizard2019 白银 5 个月前 #9

    感谢分享。。

    0
  9. Neite 白银 5 个月前 #10

    Tks

    0
  10. Ren 青铜 5 个月前 #11

    感谢您跟大家说这个技术

    0
  11. Tiab_big 白银 5 个月前 #12

    看看

    2
  12. sitem 青铜 5 个月前 #13

    zack2026:
    thank you

    thank you

    0
  13. hexsen 白银 5 个月前 #14

    感谢大佬分享!

    1
  14. jin_falcon 白银 5 个月前 #15

    感谢大佬

    1
  15. Gwanyou 黄金 3 YEARS 5 个月前 #16

    看看捏

    0
  16. erzy 白银 5 个月前 #17

    :xhj001: :ac01:

    0
  17. santos 白银 5 个月前 #18

    非常需要啊,哪怕是过二验也好啊

    0
  18. ads2001 青铜 5 个月前 #19

    学习一下

    1
  19. ADellolio6 青铜 5 个月前 #20

    感谢分享

    0
  20. Kyaba_Zuraba 青铜 5 个月前 #21

    看看捏

    0
  21. MSaZs 黄金 5 个月前 #22

    看看

    0
  22. lord 白银 5 个月前 #23

    好东西

    0
  23. ROM_JUN 白银 5 个月前 #24

    非常感谢,我现在真的很需要

    0
  24. Paper_Good 白银 5 个月前 #25

    学习一下

    0
  25. freelost 黄金 5 个月前 #26

    看看是怎么个事

    0
  26. Paper_Good 白银 5 个月前 #27
    回复 @Paper_Good:学习一下

    这个是假的rt 没有用的

    0
  27. wzqi 白银 5 个月前 #28

    稳重而又认真的学习中

    0
  28. liyuan 白银 5 个月前 #29

    看看

    0
  29. wcq 白银 5 个月前 #30

    感谢大佬,正需要

    0