我正在尝试使用aurelia-auth (版本3.0.5)在我的应用程序中进行身份验证。我正在尝试使用“本地策略”,并提供了一个虚拟的身份验证服务。我使用以下代码调用login方法,并尝试使用电子邮件/密码调用或对象调用,但在Chrome调试器中检查网络流量时,我没有收到发送到服务器的用户名和密码的有效负载。它确实转到了正确的url,并且我的服务正在被调用,但没有任何信息来进行身份验证。
login() {
let cred = { user: this.email, password: this.password };
// return this.auth.login(this.email, this.password)
return this.auth.login(cred)
.then(response=>{
console.log('success logged ' + response);
})
.catch(err=>{
err.json().then(function(e) {
console.log('login failure : ' + e.message);
});
});
}这是我对Aurelia-auth组件的配置:
var config = {
signupUrl: 'users',
loginUrl: '/api/auth/login',
tokenName: 'id_token',
loginRedirect: '#/'
};发布于 2017-04-09 14:51:39
您是否100%确定要将数据发送到相同的域?在检查开发工具时,您会看到请求的http谓词类型是什么?POST还是OPTIONS?
https://stackoverflow.com/questions/43152850
复制相似问题