devise_token_authを使って、トークンベースの認証機能を実装していたら、タイトルのエラーが出てきました。。。
2日ほど訳が分からず悩んでいました。。。。。
changePassword(body) {
let headers = new Headers({
'access-token': this.tokenInfo(),
'uid': this.uidInfo(),
'client': this.clientInfo()
});
let options = new RequestOptions({headers: headers});
return this.http.put(this.url + '/auth/password', body, options).subscribe((response) => {
console.log(response.json());
});
}
しかし、よくよく考えてみたら、ヘッダに
- accecc-token
- client
- uid
の3つだけでなく、content-typeもいるんじゃね?ってなって加えてみたらいけました
changePassword(body) {
let headers = new Headers({
'Content-Type': 'application/json',
'access-token': this.tokenInfo(),
'uid': this.uidInfo(),
'client': this.clientInfo()
});
let options = new RequestOptions({headers: headers});
return this.http.put(this.url + '/auth/password', body, options).subscribe((response) => {
console.log(response.json());
});
}

コメントを残す