You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

启用MFA后无法获取Anypoint Platform的Bearer Token求助

启用MFA后获取Anypoint Platform Bearer Token

当你的Anypoint账号启用MFA后,直接调用https://anypoint.mulesoft.com/accounts/login只会返回MFA验证请求,而非直接的Bearer Token。以下是正确的获取流程:

1. 发起初始登录请求

首先仍用用户名密码调用登录端点:

POST https://anypoint.mulesoft.com/accounts/login
Content-Type: application/json

{
  "username": "你的账号邮箱",
  "password": "你的账号密码"
}

此时会收到你提供的响应内容,包含验证URL和request JWT参数。

2. 提交MFA验证码完成验证

向返回的https://verify.salesforce.com/verify/发送POST请求,带上request参数和Salesforce Authenticator生成的6位实时验证码:

POST https://verify.salesforce.com/verify/
Content-Type: application/json

{
  "request": "返回的JWT字符串",
  "code": "Salesforce Authenticator生成的6位验证码"
}

验证成功后,响应会包含access_token字段,这就是你需要的Bearer Token,使用格式为Bearer <token值>。

自动化场景替代方案

如果是脚本、CI/CD等自动化场景,手动输入验证码效率低下,可使用Connected App客户端凭证流:

  • 在Anypoint Platform中创建Connected App,配置对应权限
  • 使用客户端ID和密钥调用https://anypoint.mulesoft.com/accounts/api/v2/oauth2/token获取Token:
POST https://anypoint.mulesoft.com/accounts/api/v2/oauth2/token
Content-Type: application/x-www-form-urlencoded

grant_type=client_credentials&client_id=你的客户端ID&client_secret=你的客户端密钥

该方式无需MFA验证,适合服务端之间的自动化调用。

内容的提问来源于stack exchange,提问作者Andy

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.26 14:07:44