使用Power Automate向SharePoint补丁数据时遇401令牌交换错误求助
错误信息
"status": 401, "source": "https://unitedstates-002.token.azure-apim.net:443/tokens/unitedstates-002/sharepointonline/1e42c429246940348c2c2f921babcd77/exchange", "message": "Error from token exchange: Runtime call was blocked because connection has error status: Enabled| Error, and sharepointonline is in the block list. Connection errors: [ParameterName: token, Error: Code: Unauthorized, Message: 'Failed to refresh access token for service: sharepointonlinecertificatev2. Correlation Id=cb83fd44-520e-46ea-88b2-38922d9c5144, UTC TimeStamp=10/8/2024 4:01:22 PM, Error: Failed to acquire token from AAD: {\"error\":\"invalid_grant\",\"error_description\":\"AADSTS700082: The refresh token has expired due to inactivity. The token was issued on 2024-06-20T14:19:31.5093139Z and was inactive for 90.00:00:00. Trace ID: 9d5ea7b4-4c20-4c25-a673-0cae368c7400 Correlation ID: 819d6256-3dea-4a10-b3b3-7c5e1fe0b6cf Timestamp: 2024-10-08 16:01:22Z\",\"error_codes\":[700082],\"timestamp\":\"2024-10-08 16:01:22Z\",\"trace_id\":\"9d5ea7b4-4c20-4c25-a673-0cae368c7400\",\"correlation_id\":\"819d6256-3dea-4a10-b3b3-7c5e1fe0b6cf\",\"error_uri\":\"https://login.windows.net/error?code=700082\"}']"
问题原因
- 刷新令牌过期:Azure AD的刷新令牌默认有效期为90天,若超过90天未使用该令牌进行身份验证刷新,令牌会因闲置失效(对应错误码AADSTS700082)。
- 连接进入错误阻止列表:令牌失效导致Power Automate的SharePoint连接状态变为
Enabled|Error,被系统加入阻止列表,最终触发401未授权的令牌交换错误。
解决方案
- 重新验证SharePoint连接
- 登录Power Automate门户,找到对应流使用的SharePoint连接。
- 点击连接右侧的三个点,选择「编辑」,重新完成身份验证流程,获取新的有效令牌。
- 确认连接状态恢复为正常后,重新运行流。
- 重置连接(重新验证无效时)
- 删除原有的SharePoint连接,重新创建一个新的连接。
- 更新Power Automate流中所有使用旧连接的动作,替换为新连接。
- 检查权限配置
- 确保Power Apps调用流时使用的身份,以及Power Automate流的运行身份,在目标SharePoint站点和列表中拥有编辑权限。
- 若使用证书或服务账户认证,确认Azure AD应用注册的权限配置正确,无过期或权限不足情况。
内容的提问来源于stack exchange,提问作者Peacefull Music
相关产品推荐
相关产品推荐

