Angularjs 休息电话的春季安全

Angularjs 休息电话的春季安全,angularjs,spring,spring-boot,spring-security,Angularjs,Spring,Spring Boot,Spring Security,我遇到以下错误: 飞行前的响应具有无效的HTTP状态代码401 我使用的代码是: $httpProvider.defaults.headers.common['Authorization'] = 'Basic auth' + "username" + ":" + "password"; 当我尝试在Chrome中运行此代码时,它会给我这样的错误,但当我尝试在Internet Explorer中运行相同的代码时,它工作正常 Maven依赖项: org.springframework.boot 弹

我遇到以下错误:

飞行前的响应具有无效的HTTP状态代码401

我使用的代码是:

$httpProvider.defaults.headers.common['Authorization'] = 'Basic auth' + "username" + ":" + "password";
当我尝试在Chrome中运行此代码时,它会给我这样的错误,但当我尝试在Internet Explorer中运行相同的代码时,它工作正常

Maven依赖项:


org.springframework.boot
弹簧启动安全
org.springframework.security.oauth
spring-security-oauth2
application.properties

security.user.password=密码
security.user.name=用户名

请帮助我。

您需要发布完整的Spring安全配置,XML或Java配置。除了application.properties之外,我没有在服务端使用任何配置文件@PaulNUK@Johnk看起来您确实需要某种配置,才能使spring安全性像您期望的那样工作。请参阅此处的教程@Zeus请注意,他使用的是Spring Boot,它将自动配置基本身份验证所需的所有内容。@Zeus在internet explorer中尝试时,它工作正常,但在Chrome中不工作。我没有得到什么改变,使其在铬工作