protected-vercel-deployments
它能做什么
这个技能帮助 AI 以你自己的身份访问需要 Vercel 登录的 Vercel 部署。适合需要测试私有预览的开发者。
适用场景
- ✓当预览链接把你带到 Vercel 登录页面,而你需要测试它的时候。
- ✓当页面因 Vercel 部署保护而返回 401 或 403 错误的时候。
- ✓当你想避免为了测试而把预览站点公开的时候。
技能链接
https://github.com/vercel-labs/agent-browser/blob/main/skill-data/protected-vercel-deployments/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我的预览链接会跳转到 Vercel 登录页面。请帮我用浏览器打开并截图?”
每周 5 个新技能,1 分钟读完。
工作原理
AI 会使用你的 Vercel CLI 身份为项目创建一个短期令牌,然后把该令牌交给浏览器会话,使页面能够打开。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Protected Vercel deployments
Use the caller's existing Vercel identity and a short-lived OIDC token. Do not disable Deployment Protection, make the deployment public, or ask for a static bypass secret first.
Same-project preview
A local development token for the target project can access that project's protected Preview deployments through the default Trusted Sources self-access rule. No Trusted Sources configuration is normally required.
Confirm the local identity and Vercel CLI version:
vc whoami
vc --version
Require Vercel CLI 53.3.0 or newer before running vc project token. Versions 50.25.0 through 53.2.x write the token to stderr, so command substitution captures nothing and the credential can appear in logs. If the installed version is older, stop and ask the user to upgrade it. Do not attempt to capture or recover the token from stderr.
Set the target project and scope explicitly. If they cannot be inferred safely, ask the user. In a directory whose existing .vercel/project.json link has been verified against the target, vc project token without a project name is also valid. Do not run vc link merely to get an OIDC token: current Vercel CLI versions also pull development variables into .env.local when linking.
Create a named browser session, mint a development OIDC token with the Vercel CLI, then inject it without printing or persisting it:
export AGENT_BROWSER_SESSION="$(agent-browser session id --scope worktree --prefix vercel-preview)"
export VERCEL_PREVIEW_URL="https://my-app.vercel.app"
export VERCEL_PROJECT="my-app"
export VERCEL_SCOPE="my-team"
(
TOKEN="$(vc project token "$VERCEL_PROJECT" --scope "$VERCEL_SCOPE")"
test -n "$TOKEN"
agent-browser open "$VERCEL_PREVIEW_URL" --headers \
"{\"x-vercel-trusted-oidc-idp-token\":\"$TOKEN\"}"
)
agent-browser snapshot -i
Continue the normal workflow in that same session. The header is scoped to the target origin and applies to the document, scripts, styles, fonts, and in-page requests. If the browser session is closed or restarted, repeat the authenticated open command.
Never print the token, paste it into source, or save it in an environment file.
Other environments and callers
Trusted Sources configuration is needed when:
- a local development token must reach a protected Production deployment;
- the caller belongs to another Vercel project or team;
- the target project's self-access rules were customized; or
- Vercel returns
TRUSTED_SOURCES_ENVIRONMENT_MISMATCH.
There is no supported Vercel CLI or public REST API for editing Trusted Sources rules. An authorized human must open the target project's Settings → Deployment Protection → Trusted Sources and add only the required caller and environment mapping. A local token has the development environment, so protected Production access requires development to production.
Stop and hand off the exact rule to the human. Do not use browser automation to change access control, and do not broaden unrelated environment mappings. Retry the authenticated open after the human confirms the rule is saved.
Human intervention boundaries
The same-project development to Preview path should run without human intervention when the Vercel CLI is already authenticated and the target project and scope are known. A human is needed only when:
- the Vercel CLI has no authenticated identity and no existing
VERCEL_TOKEN; interactivevc loginrequires the user; - the installed Vercel CLI is older than
53.3.0and must be upgraded before token minting; - the correct target project or scope cannot be inferred safely for token minting;
- a Trusted Sources rule must be added or changed; the dashboard is the only supported management surface, and this changes access control;
- Secure Backend Access with OIDC Federation was disabled on the calling project and must be re-enabled in Settings → Security; or
- the static-secret fallback must be enabled or rotated and the agent needs explicit authorization for that access-control change. After approval, the agent can use
vc project protectioninstead of requiring dashboard interaction.
The agent can diagnose each case and state the exact action required, then continue after the user confirms completion.
Use the correct header
Send the Vercel-issued token as:
x-vercel-trusted-oidc-idp-token: <VERCEL_OIDC_TOKEN>
Do not substitute x-vercel-oidc-token. That header carries workl
常见问题
这会改变部署设置吗?
不会。技能说明,不会关闭 Deployment Protection,也不会把部署设为公开。
需要哪个版本的 Vercel CLI?
技能要求版本 53.3.0 或更高,才能创建令牌。
我需要静态的绕过密钥吗?
不需要。技能不建议先索要这种密钥,而是使用短期 OIDC 令牌。
详情
作者的原始描述
Access and test Vercel deployments protected by Vercel Authentication, SSO, or Deployment Protection with agent-browser. Use when a preview or production URL redirects to a Vercel login page, returns a protection 401 or 403, or needs short-lived Trusted Sources OIDC authentication instead of a static bypass secret or public exception.
热度
- GitHub 星标
- 45k
- 排名
- #6360
- 许可证
- Apache-2.0
- 更新时间
- 2026/11/1
评论
- …
同一仓库的更多技能
technical-writer
45k教你的智能体编写和修改开发者文档,如指南、API 参考和故障排除页面,结构清晰,示例准确。
agentcore
45k帮你的智能体使用现有的 AWS 登录,在 AWS Bedrock AgentCore 云端浏览器上运行浏览器自动化,命令与本地 Chrome 相同。
core
45k教你的智能体通过快照和元素引用控制网页浏览器,从而打开页面、点击、填写表单并读取内容。
derive-client
45k教你的智能体录制一次网站的网络流量,然后构建一个独立客户端,无需浏览器即可调用其内部 API。