Azure active directory AADSTS5002710:无效的JWT令牌:标头格式不正确
我正在尝试在我的客户端(ReactJS)、Express+Node.js服务器(API)和Microsoft Graph之间实现“代表”流 到目前为止,我已经从microsoft(客户端)请求了accessToken,并向我的API发出了请求 当我尝试从API向Azure active directory AADSTS5002710:无效的JWT令牌:标头格式不正确,azure-active-directory,jwt,azure-ad-graph-api,send-on-behalf-of,Azure Active Directory,Jwt,Azure Ad Graph Api,Send On Behalf Of,我正在尝试在我的客户端(ReactJS)、Express+Node.js服务器(API)和Microsoft Graph之间实现“代表”流 到目前为止,我已经从microsoft(客户端)请求了accessToken,并向我的API发出了请求 当我尝试从API向https://login.microsoftonline.com/tenantID/oauth2/v2.0/token 完全错误: { 错误:“无效的_请求”, 错误描述:“AADSTS5002710:无效的JWT令牌:标头格式不正确。
https://login.microsoftonline.com/tenantID/oauth2/v2.0/token
完全错误:
{
错误:“无效的_请求”,
错误描述:“AADSTS5002710:无效的JWT令牌:标头格式不正确。\r\n”+
'跟踪ID:068a382b-6f83-40f6-b1b1-7134223f4500\r\n'+
'相关ID:f46a2c03-84e8-46b3-b9d6-467174befa0b\r\n'+
'时间戳:2021-01-06 16:26:40Z',
错误代码:[5002710],
时间戳:“2021-01-06 16:26:40Z”,
跟踪id:'068a382b-6f83-40f6-b1b1-7134223f4500',
相关性id:'f46a2c03-84e8-46b3-b9d6-467174befa0b'
}
我的请求的主体是根据教程“https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-on-behalf-of-flow“
我经常从微软在线服务器上得到上述错误。
我已使用自己的自定义范围提出原始(客户)请求
api://54ee17f...cfe06/Access.Test
我按照教程在《邮递员》中代表流量使用。但效果很好
我的步骤如下:
断言
,下一步)GEThttps://graph.microsoft.com/v1.0/users
标题
谢谢Pamela,这让我更清楚地理解。问题是我的断言是“Bearer{accessToken}”,这导致了错误。一旦我删除,它现在的工作预期。再次感谢。我使用了“assertion=Bearer{accessToken}”而不是“assertion={accessToken}”,删除了“Bearer”修复了这个问题。
https://login.microsoftonline.com/{tenant}/oauth2/v2.0/authorize
?scope={like api://1108f6-xxxxxxx-9f622/test} openid
&redirect_uri={redirect_uri of Web API A}
&nonce=123
&client_id={client-id of Web API A}
&response_type=id_token token
https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token
grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer
&client_id={client_id of Web API B}
&client_secret={client_secret}
&assertion={access token from previous step}
&scope=https://graph.microsoft.com/user.read offline_access
&requested_token_use=on_behalf_of