我们可以在标头Owin OAuth中传递Grant_type吗

我正在尝试使用ASP.NET Web API和基于OAuth令牌的身份验证集成来构建应用程序。

OAuth中间件实现

我曾经重写OAuthAuthorizationServerProvider基类,这里是我的代码:

public override Task 
ValidateclientAuthentication(OAuthValidateclientAuthenticationContext context)


public override Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context)

客户: 我使用Postman进行API交互,在这里我使用以下参数来获取有效的身份验证令牌:

"headers": {
  "content-type": "application/x-www-form-urlencoded",}

"data":{
  "grant_type": "password","username": "######","password": "######","client_id": "#######"
}

它运行良好并获得了有效的身份验证令牌。

我想在标头部分而不是请求正文中传递grant_type

"headers": {
  "content-type": "application/x-www-form-urlencoded","grant_type": "password",}
"data":{    
  "username": "######","client_id": "#######"
}

但出现如下错误:

{
  "error": "unsupported_grant_type"
}

我们可以传递grant_type标头部分吗?

wondernuaa 回答:我们可以在标头Owin OAuth中传递Grant_type吗

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3109583.html

大家都在问