Chr*_*ley 6 .net c# asp.net-web-api owin asp.net-identity
我有以下内容:
OAuthAuthorizationServerOptions OAuthServerOptions = new OAuthAuthorizationServerOptions()
{
    AllowInsecureHttp = true,
    TokenEndpointPath = new PathString("/token"),
    AccessTokenExpireTimeSpan = TimeSpan.FromDays(1),
    Provider = new SimpleAuthorizationServerProvider(),                
};
一切正常,我需要使用带有参数的/ token调用request bodyContent-Type: application/x-www-form-urlencoded
我的问题是我要求允许从无法发送数据的客户端生成令牌,因为Content-Type: application/x-www-form-urlencoded她只能将参数作为Json发送,根据OAuth 2不合适,除此之外,Microsoft Owin不允许它.
如何为此目的手动生成令牌?我假设我应该创建一个webapi方法来实现它,但我如何使用常规的Microsoft Owin提供程序?
非常感谢
您可以创建一个 WebApi 端点作为代理,这意味着您将接收 JSON 形式的参数,并且在内部您可以调用将/Token参数转换为Content-Type: application/x-www-form-urlencoded.
看一下http://restsharp.org/,它将简化您对令牌提供商的内部调用。
| 归档时间: | 
 | 
| 查看次数: | 586 次 | 
| 最近记录: |