daimon3332/Outlook-Oauth-GetToken
A standalone OAuth2 refresh_token retrieval tool for existing Outlook / Hotmail accounts. 面向已有 Outlook / Hotmail 账号的独立 OAuth2 refresh_token 获取工具
Featured achievements
The project's latest awards
#2 Repository of the week
#2 Repository of the week
#4 Repository of the week
OutlookGetToken
给已注册但还没有 Graph refresh_token 的 Outlook / Hotmail 账号,批量走一遍 OAuth2 授权,把 token 写入结果文件。
核心脚本:get_refresh_token.py(patchright 浏览器自动化 + 授权码换 token)。
1. 如何使用
1.1 环境
git clone https://github.com/daimon3332/Outlook-Oauth-GetToken.git
cd Outlook-Oauth-GetToken
pip install patchright requests
patchright install chromium
代理软件需已启动(默认示例为本机 127.0.0.1:7890)。
1.2 准备配置与账号
首次使用:
# Windows
copy config.example.json config.json
copy not_oauth2.example.txt not_oauth2.txt
# Linux / macOS
cp config.example.json config.json
cp not_oauth2.example.txt not_oauth2.txt
编辑 not_oauth2.txt,每行一个账号:
邮箱----密码
示例:
user1@outlook.com----YourPass1
user2@hotmail.com----YourPass2
- 以
#开头的行视为注释,忽略 - 也兼容更长行(如已有
邮箱----密码----client_id----token):只取前两段 邮箱与密码
按需编辑 config.json(代理、并发等,见下一节)。
1.3 运行
python get_refresh_token.py
成功后会追加写入 oauth2.txt:
邮箱----密码----client_id----refresh_token
1.4 使用注意
- 工具会弹真实浏览器窗口(
headless=False) - 不会自动绑定/接码辅助邮箱;密码后的「保护帐户」页会点 暂时跳过
- 若已绑过辅助邮箱且弹出「验证你的电子邮件」,会点 使用密码 继续
- 出现 帐户已锁定 → 该号直接失败
- 同一账号多次成功会重复追加到输出文件,请自行去重
2. config.json 配置
将 config.example.json 复制为 config.json 后修改:
{
"input_file": "not_oauth2.txt",
"output_file": "oauth2.txt",
"concurrent": 2,
"proxy": {
"mode": "single",
"type": "http",
"host": "127.0.0.1",
"single_port": 7890,
"port_start": 24000,
"port_end": 24005,
"max_per_proxy": 20
}
}
2.1 顶层字段
| 字段 | 类型 | 说明 |
|---|---|---|
input_file | string | 输入文件名,默认 not_oauth2.txt |
output_file | string | 输出文件名,默认 oauth2.txt,追加写入 |
concurrent | number | 并发浏览器数;实际为 min(concurrent, 账号数) |
proxy | object | 代理配置,见下表 |
2.2 proxy
| 字段 | 说明 |
|---|---|
mode | single:只用 single_port;multiple:使用 port_start~port_end 端口池 |
type | 代理协议,如 http、socks5 |
host | 代理主机,常见 127.0.0.1 |
single_port | mode=single 时的端口 |
port_start / port_end | mode=multiple 时的端口闭区间 |
max_per_proxy | 单个端口在进程内最多被选中次数;用满后该端口暂不选,全满则重置计数再选 |
3. 代码流程
入口:python get_refresh_token.py → main()。
3.1 总览
读 config.json 与账号文件
→ 按 concurrent 并发处理每个账号
→ 成功:追加写入 oauth2.txt
→ 失败:记录原因后继续下一个
3.2 单账号流程
启动 Chromium(带代理)
→ 打开 Graph OAuth 授权页
→ 状态循环(约 120s 内)
├─ 一旦出现 localhost...?code= → 立刻结束登录,换 token
├─ 「帐户已锁定」 → 失败
├─ 「验证你的电子邮件」 → 点「使用密码」
├─ 密码框 → 填密码 + 「下一步」
├─ 邮箱框 → 填登录邮箱
├─ 「让我们来保护你的帐户」 → 「暂时跳过」
├─ 「保持登录状态?」 → 点「否」
└─ 授权同意页 → 接受
→ 用 code 换 refresh_token
→ 关浏览器
3.3 密码之后的分支
保护帐户 / 锁定页都在输入密码之后。
| 页面 | 行为 |
|---|---|
| 验证你的电子邮件 | 点「使用密码」 |
| 输入密码 | 填写并点「下一步」 |
| 让我们来保护你的帐户 | 点「暂时跳过」 |
| 帐户已锁定 | 直接失败 |
| 保持登录 | 点「否」 |
| 同意 / 已授权 | 点接受,或直接拿到 code |
友情链接
linux.do:学AI,上L站!!!- Nodeseek.com:Nodeseek是一个为热爱web开发、托管、vps /服务器和其他极客事物的人提供的地方。
Similar Projects
Discover other similar projects and AI models.
Outlook/Hotmail account batch registration tool. Outlook / Hotmail 账号批量注册工具,支持自动获取 OAuth2 refresh_token
Outlook/Hotmail local account management WebUI supports batch account import, status detection (alive/banned), token refresh and synchronization.Outlook / Hotmail 本地账号管理 WebUI,支持账号批量导入、状态检测(存活/封禁)、令牌刷新与同步。
Python tool for converting files and office documents to Markdown.
AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
Reverse engineer anything with agents, from app behavior down to native binaries.
The AI that really does things. Any OS. Any Platform. The lobster way. 🦞