升级Teams Toolkit至4.2.0后调试Teams应用出现DeveloperPortalAPIFailed错误
问题现象
升级Teams Toolkit至4.2.0版本后,在Visual Studio Code中调试Teams应用时失败,核心报错信息如下:
API call to Developer Portal failed: Error, Request failed with status code 403, API name: create-app, X-Correlation-ID: undefined. This may come from some intermittent service error. Please wait for a few minutes and retry the current step. data: "<%3Fxml version="<REDACTED: user-file-path>" encoding="<REDACTED: user-file-path>"%3F>
AuthenticationFailedServer failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the <REDACTED: user-file-path>:<REDACTED: user-file-path>:2022-12-21T17:17:27.0783537ZAuthentication scheme Bearer is not supported in this version."
调试流程无法正常在Microsoft Teams中加载应用。
解决方案
清理Teams Toolkit认证缓存
- 关闭Visual Studio Code
- 删除对应系统的缓存文件夹:
- Windows:
%appdata%\Code\User\globalStorage\teams.microsoft.teams-toolkit-vscode - macOS:
~/Library/Application Support/Code/User/globalStorage/teams.microsoft.teams-toolkit-vscode - Linux:
~/.config/Code/User/globalStorage/teams.microsoft.teams-toolkit-vscode
- Windows:
- 重新打开VS Code,重新登录Teams Toolkit关联的微软账号
切换Teams Toolkit版本
4.2.0版本存在认证接口兼容性问题,可尝试:- 降级至4.1.x等旧稳定版本:在VS Code扩展市场找到Teams Toolkit,点击「安装另一个版本」选择历史稳定版
- 升级至最新正式版/预览版:检查扩展市场是否有更新版本,此类版本通常已修复认证相关问题
验证开发者门户权限
直接登录Microsoft Teams开发者门户,确认账号拥有创建应用的权限,且账号状态正常。若门户内操作无异常,返回VS Code重新执行调试流程重置项目配置
删除项目根目录下的.fx文件夹,然后在VS Code中重新执行「Provision」(预配)步骤,重新生成应用配置
内容的提问来源于stack exchange,提问作者Ajith

