0
aurelia-auth 플러그인에 문제가 있습니다. 내 백엔드에서 토큰을 요청하고 성공적인 응답을 얻을 수 있습니다. 그러나 내 앱이 인증 된 것으로 보이지 않으며 토큰이 로컬 저장소에 저장되지 않습니다.요청이 성공하면 토큰이 로컬 저장소에 추가되지 않습니다.
인증-config.js
var config = {
baseUrl: 'http://localhost:64794',
signupUrl: 'users',
loginUrl: 'api/values/PostPassword',
tokenName: 'id_token',
loginRedirect: '#/welcome',
authHeader: 'Authorization',
authToken: 'Bearer',
storage: 'localStorage'
}
export default config;
login.js
import {AuthService} from 'aurelia-auth';
import {inject} from 'aurelia-framework';
@inject(AuthService)
export class Login {
heading = 'Login';
email = '';
password = '';
loginError = '';
constructor(auth) {
this.auth = auth;
};
login() {
return this.auth.login(this.email, this.password)
.then(response => {
console.log("Login response: " + response);
console.log("Auth: " + this.auth.isAuthenticated());
})
.catch(error => {
this.loginError = error.response;
});
};
}
콘솔 출력
: 어떤 조언을 주시면 감사하겠습니다Login response: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6ImIiLCJuYmYiOjE1MDkyNzkxMzYsImV4cCI6MTUwOTI4MDMzNiwiaWF0IjoxNTA5Mjc5MTM2fQ.4QZu8pQI-K_71x_CKT9ANu1vQD7VvVUcyep51CvvCXg
login.js:27 Auth: false
.
오, 난 당신이 무슨 뜻인지 볼 모양을 가지고 - 내 경우에는 내 설정에서, 그것을해야 'id_token' 되니? 답장을 보내 주셔서 감사합니다. – TomSelleck