如何为params与in-body配置Azure AD Oauth2令牌端点?

问题描述 投票:0回答:1

我正在使用Azure AD为API提供Oauth2身份验证。 Setup&config似乎对我来说很好,但是合作伙伴指出Oauth2令牌端点不喜欢内联参数 - 它想要在HTTP体中传递的params。

例如:此调用返回AADSTS90014:请求正文必须包含以下参数:'grant_type':

https://login.microsoftonline.com/my tennant / oauth2 / token?grant_type = client_credentials&client_id = theclientid&client_secret = thesecret&code = AUTHORIZATION_CODE'

但是一个帖子与身体中相同的参数作为表格数据工作得很好。我相信Oauth应该支持参数化调用(如google documentation所示)。 是否在Azure中的某个位置配置Oauth2端点以接受令牌参数作为post params而不是在表单体中发送?

azure oauth-2.0 azure-api-management
1个回答
0
投票
he request body must contain the following parameter: 'grant_type':

基于响应我会说你错误地设置了content-type头。

如果您要发布此请求:https://login.microsoftonline.com/my tennant/oauth2/token?grant_type=client_credentials&client_id=theclientid&client_secret=thesecret&code=AUTHORIZATION_CODE'确保您将content-type设置为application/x-www-form-urlencoded

如果你是身体中的参数,则将content-type设置为application/json

© www.soinside.com 2019 - 2024. All rights reserved.