我在同一解决方案中使用WebAPI处理Angular。当我调用OAuth令牌方法时,它在Local中正常工作。但是,不能在IIS中工作。下面是代码。
public void Configuration(IAppBuilder app)
{
IKernel kernel = IocConfig.GetKernel;
IocConfig.RegisterIoc(GlobalConfiguration.Configuration);
var AuthProvider = kernel.Get<DigitalSignageAuthorizationProvider>();
app.UseOAuthAuthorizationServer(new OAuthAuthorizationServerOptions
{
TokenEndpointPath = new PathString("/token"),
AccessTokenExpireTimeSpan = TimeSpan.FromDays(3),
Provider = AuthProvider,
AllowInsecureHttp = true,
});
//app.UseOAuthBearerAuthentication(new OAuthBearerAuthenticationOptions());
var oauthConfig = new OAuthBearerAuthenticationOptions
{
AuthenticationMode = AuthenticationMode.Active,
AuthenticationType = "Bearer"
};
app.UseOAuthBearerAuthentication(oauthConfig);
}
Angular Code
function userLoginToken(data) {
var self = this;
console.log(data);
return self.postData('/token', data);
}
发布数据有$ resource api调用。