2016-12-01 57 views
0

我有一个asp核心角2 SPA网站,它通过oidc客户端向IdenityServer进行身份验证。IdentitySever与SPA网站CORS问题

我尝试从javascript walthrough example出来的spa认证。

为了模拟水疗中心网站上http://localhost:5000的identityserver运行在http://localhost:7890

在IdentityServer我添加AllowedCorsOrigins给客户配置不同的域。

AllowedCorsOrigins = new List<string> 
{ 
    "http://localhost:5000" 
} 

但我仍得到了跨域问题的问题时,我触发重定向

的XMLHttpRequest无法加载 http://localhost:7890/identity-server/.well-known/openid-configuration。 请求的 资源上没有“Access-Control-Allow-Origin”标题。原因'http://localhost:5000'因此不允许 访问。该响应具有HTTP状态代码404.

我错过了什么?

回答

3

响应了HTTP状态代码404

这可能是错误消息的最显著的部分。您已启用CORS,但大概只适用于实际存在的页面。

你得到的URL错误。

+0

是的。我没有完全意识到它。该分部“identityserver”不是identityserver URL的一部分。修复它 –