私はAngularJSのクライアントからWeb RestFUL APIを使用しています。JSESSIONID値を取得し、AngularJSでCookieを作成します。
app.controller('LoginController', [
'$http',
'$cookies',
function($http, $cookies) {
this.credentials = {};
this.http = $http;
this.login = function() {
console.log(this.credentials);
var authdata = btoa(
this.credentials.username +
':' +
this.credentials.password
);
$http.defaults.headers.common['Authorization'] = 'Basic ' + authdata;
console.log($http);
var res = $http.post("http://API_NAME/library");
res.success(function(data, status, header){
alert('Successfull func');
console.log($cookies.get('JSESSIONID'));
});
res.error(function(data, status, headers, config) {
console.log('Error Log');
});
};
},
]);
はその後、私はJSESSIONID値を取得し、私のブラウザで手動で作成するngCookiesを使用していますが、私はそれにアクセスすることはできません。このHTTPヘッダーレスポンス
Set-Cookie:JSESSIONID=azekazEXAMPLErezrzez; Path=/; HttpOnly
を持っています。
私はStackOverflowでこれについてのすべての記事を見ましたが、非難されているか完全に不明です。
ご協力いただきありがとうございます。
なぜJSESSIONIDにAngularでアクセスする必要がありますか?そのCookieはHttpOnlyとしてマークされています。つまり、JSでアクセスできません。 –
私は、JSESSIONIDが自動的に処理されたクッキーの送信を取得できませんでした。 私はそれを手動でやらなければならないと思った。 コメントは私にこれを理解するのを助けました。問題は –