无法使用'UseOAuthBearerTokens'来处理Owin和Identity RTM

时间:2013-10-03 23:47:22

标签: c# asp.net-identity owin

我用

 app.UseOAuthBearerTokens(OAuthOptions);

var options = new OAuthAuthorizationServerOptions
{

    TokenEndpointPath = new Microsoft.Owin.PathString("/Token"),
    AuthorizeEndpointPath = new Microsoft.Owin.PathString("/api/Account/ExternalLogin"),
    Provider = new ApplicationOAuthProvider<CampusDaysUser>(PublicClientId, IdentityManagerFactory, CookieOptions)
};

但是网址http://example.com/Token/会返回错误:

  

无法找到资源。

1 个答案:

答案 0 :(得分:5)

    OAuthOptions = new OAuthAuthorizationServerOptions
    {
        TokenEndpointPath = new Microsoft.Owin.PathString("/Token"),
        AllowInsecureHttp = true,
        AuthorizeEndpointPath = new Microsoft.Owin.PathString("/api/Account/ExternalLogin"),
        Provider = new ApplicationOAuthProvider<CampusDaysUser>(PublicClientId, IdentityManagerFactory, CookieOptions)
    };

现在需要设置allow http才能使其正常工作。阅读评论,这应该只在开发中完成。 制作你应该获得证书并使用SSL